sha256

Pure Haskell SHA-256, HMAC-SHA256 (docs.ppad.tech/sha256).
git clone git://git.ppad.tech/sha256.git
Log | Files | Refs | README | LICENSE

commit 0d9a7a2f83fc95bf3ac1d335d1c0237d397e44bc
parent 5524b108ff5ebdfb113d77a313fa881f873480c1
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 28 Dec 2025 11:41:03 -0330

release: v0.2.4

Diffstat:
MCHANGELOG | 3+++
MREADME.md | 14+++++++-------
Mflake.lock | 28++++++++++++++--------------
Mflake.nix | 4++--
Mppad-sha256.cabal | 4++--
5 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,5 +1,8 @@ # Changelog +- 0.2.4 (2025-12-28) + * Adds an 'llvm' build flag and tests with GHC 9.10.3. + - 0.2.3 (2025-01-21) * Improves padding handling for the strict bytestring case, yielding performance increases for both 'hash' and 'hmac'. diff --git a/README.md b/README.md @@ -62,16 +62,16 @@ Current benchmark figures on an M4 Silicon MacBook Air look like (use ``` benchmarking ppad-sha256/SHA256 (32B input)/hash - time 265.9 ns (265.7 ns .. 266.1 ns) + time 194.6 ns (194.4 ns .. 194.7 ns) 1.000 R² (1.000 R² .. 1.000 R²) - mean 266.3 ns (266.1 ns .. 266.5 ns) - std dev 645.1 ps (524.2 ps .. 829.3 ps) + mean 194.7 ns (194.6 ns .. 194.9 ns) + std dev 638.1 ps (461.8 ps .. 947.6 ps) benchmarking ppad-sha256/HMAC-SHA256 (32B input)/hmac - time 877.7 ns (872.1 ns .. 886.0 ns) - 1.000 R² (0.999 R² .. 1.000 R²) - mean 873.3 ns (871.5 ns .. 877.5 ns) - std dev 8.491 ns (4.940 ns .. 15.65 ns) + time 702.6 ns (701.9 ns .. 703.5 ns) + 1.000 R² (1.000 R² .. 1.000 R²) + mean 703.5 ns (702.9 ns .. 704.5 ns) + std dev 2.654 ns (1.724 ns .. 3.640 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 @@ -25,11 +25,11 @@ pkgs = import nixpkgs { inherit system; }; hlib = pkgs.haskell.lib; - llvm = pkgs.llvmPackages_15.llvm; + llvm = pkgs.llvmPackages_19.llvm; base16 = ppad-base16.packages.${system}.default; - hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { + hpkgs = pkgs.haskell.packages.ghc910.extend (new: old: { ppad-base16 = base16; ${lib} = old.callCabal2nixWithOptions lib ./. "--enable-profiling" { ppad-base16 = new.ppad-base16; diff --git a/ppad-sha256.cabal b/ppad-sha256.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: ppad-sha256 -version: 0.2.3 +version: 0.2.4 synopsis: The SHA-256 and HMAC-SHA256 algorithms 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, 9.6.6, 9.6.4 } +tested-with: GHC == 9.10.3 extra-doc-files: CHANGELOG description: A pure implementation of SHA-256 and HMAC-SHA256 on strict and lazy