chacha

The ChaCha20 stream cipher (docs.ppad.tech/chacha).
git clone git://git.ppad.tech/chacha.git
Log | Files | Refs | README | LICENSE

commit 6da57b480038c829424daa7fc6d4289159b84a08
parent 6752c4336c1b581ae7875b1c9a0eaed115e420a3
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 28 Dec 2025 16:26:52 -0330

release: v0.2.1

Diffstat:
MCHANGELOG | 3+++
MREADME.md | 6+++---
Mflake.lock | 28++++++++++++++--------------
Mflake.nix | 12+++++++++---
Mppad-chacha.cabal | 4++--
5 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,5 +1,8 @@ # Changelog +- 0.2.1 (2025-12-28) + * Adds an 'llvm' build flag and tests with GHC 9.10.3. + - 0.2.0 (2025-06-21) * Both the ChaCha block function and stream cipher are now total, returning values of 'Left InvalidKey' or 'Left InvalidNonce' when diff --git a/README.md b/README.md @@ -45,10 +45,10 @@ benchmark suite): ``` benchmarking ppad-chacha/cipher - time 485.7 ns (485.2 ns .. 486.3 ns) + time 468.3 ns (467.9 ns .. 468.8 ns) 1.000 R² (1.000 R² .. 1.000 R²) - mean 485.9 ns (485.1 ns .. 486.3 ns) - std dev 1.943 ns (1.389 ns .. 2.809 ns) + mean 468.4 ns (468.0 ns .. 469.2 ns) + std dev 2.041 ns (1.317 ns .. 3.539 ns) ``` You should compile with the 'llvm' flag for maximum performance. diff --git a/flake.lock b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1725910328, - "narHash": "sha256-n9pCtzGZ0httmTwMuEbi5E78UQ4ZbQMr1pzi5N0LAG8=", + "lastModified": 1766840161, + "narHash": "sha256-Ss/LHpJJsng8vz1Pe33RSGIWUOcqM1fjrehjUkdrWio=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5775c2583f1801df7b790bf7f7d710a19bac66f4", + "rev": "3edc4a30ed3903fdf6f90c837f961fa6b49582d1", "type": "github" }, "original": { @@ -51,11 +51,11 @@ ] }, "locked": { - "lastModified": 1741625558, - "narHash": "sha256-ZBDXRD5fsVqA5bGrAlcnhiu67Eo50q0M9614nR3NBwY=", + "lastModified": 1766934151, + "narHash": "sha256-BUFpuLfrGXE2xi3Wa9TYCEhhRhFp175Ghxnr0JRbG2I=", "ref": "master", - "rev": "fb63457f2e894eda28250dfe65d0fcd1d195ac2f", - "revCount": 24, + "rev": "58dfb7922401a60d5de76825fcd5f6ecbcd7afe0", + "revCount": 26, "type": "git", "url": "git://git.ppad.tech/base16.git" }, @@ -71,11 +71,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1737297101, - "narHash": "sha256-EnXnq+JLflbWt+DvaGGnY2gfAqsGNOm5vPgHh3hkfwQ=", + "lastModified": 1766932084, + "narHash": "sha256-GvVsbTfW+B7IQ9K/QP2xcXJAm1lhBin1jYZWNjOzT+o=", "ref": "master", - "rev": "f29823875250bc99b3891f7373535ccde9a29a44", - "revCount": 1, + "rev": "353e61763b959b960a55321a85423501e3e9ed7a", + "revCount": 2, "type": "git", "url": "git://git.ppad.tech/nixpkgs.git" }, diff --git a/flake.nix b/flake.nix @@ -26,10 +26,16 @@ pkgs = import nixpkgs { inherit system; }; hlib = pkgs.haskell.lib; - llvm = pkgs.llvmPackages_15.llvm; + llvm = pkgs.llvmPackages_19.llvm; - hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { - ppad-base16 = ppad-base16.packages.${system}.default; + base16 = ppad-base16.packages.${system}.default; + base16-llvm = + hlib.addBuildTools + (hlib.enableCabalFlag base16 "llvm") + [ llvm ]; + + hpkgs = pkgs.haskell.packages.ghc910.extend (new: old: { + ppad-base16 = base16-llvm; ${lib} = new.callCabal2nixWithOptions lib ./. "--enable-profiling" {}; }); diff --git a/ppad-chacha.cabal b/ppad-chacha.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: ppad-chacha -version: 0.2.0 +version: 0.2.1 synopsis: A pure ChaCha20 stream cipher license: MIT license-file: LICENSE @@ -8,7 +8,7 @@ author: Jared Tobin maintainer: jared@ppad.tech category: Cryptography build-type: Simple -tested-with: GHC == 9.8.1 +tested-with: GHC == 9.10.3 extra-doc-files: CHANGELOG description: A pure ChaCha20 stream cipher and block function.