ripemd160

Pure Haskell RIPEMD-160, HMAC-RIPEMD160 (docs.ppad.tech/ripemd160).
git clone git://git.ppad.tech/ripemd160.git
Log | Files | Refs | README | LICENSE

commit 449d59398770ee5cda2a939cfc6f269b3e49c900
parent 4fe3998c0d94dea7e059602747413d5825e34330
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 28 Dec 2025 12:33:32 -0330

release: v0.1.4

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

diff --git a/CHANGELOG b/CHANGELOG @@ -1,5 +1,8 @@ # Changelog +- 0.1.4 (2025-12-28) + * Adds an 'llvm' build flag and tests with GHC 9.10.3. + - 0.1.3 (2025-02-06) * Makes a minor optimization to register concatenation (swapping five builders for 3) and also refines builder realization by input size. diff --git a/README.md b/README.md @@ -63,16 +63,17 @@ Current benchmark figures on my M4 Silicon MacBook Air look like (use ``` benchmarking ppad-ripemd160/RIPEMD160 (32B input)/hash - time 244.2 ns (244.0 ns .. 244.4 ns) + time 179.1 ns (178.9 ns .. 179.3 ns) 1.000 R² (1.000 R² .. 1.000 R²) - mean 244.5 ns (244.4 ns .. 244.7 ns) - std dev 522.8 ps (355.8 ps .. 868.0 ps) + mean 179.7 ns (179.5 ns .. 179.9 ns) + std dev 715.4 ps (538.9 ps .. 988.3 ps) benchmarking ppad-ripemd160/HMAC-RIPEMD160 (32B input)/hmac - time 836.1 ns (835.3 ns .. 837.0 ns) + time 661.4 ns (660.0 ns .. 663.3 ns) 1.000 R² (1.000 R² .. 1.000 R²) - mean 836.6 ns (835.6 ns .. 837.4 ns) - std dev 3.105 ns (2.474 ns .. 4.117 ns) + mean 667.3 ns (664.7 ns .. 669.9 ns) + std dev 8.607 ns (7.495 ns .. 9.627 ns) + variance introduced by outliers: 12% (moderately inflated) ``` 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,12 +25,17 @@ 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; + base16-llvm = + hlib.addBuildTools + (hlib.enableCabalFlag base16 "llvm") + [ llvm ]; - hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { - ppad-base16 = base16; + + hpkgs = pkgs.haskell.packages.ghc910.extend (new: old: { + ppad-base16 = base16-llvm; ${lib} = old.callCabal2nixWithOptions lib ./. "--enable-profiling" { ppad-base16 = new.ppad-base16; }; @@ -62,6 +67,7 @@ echo "cc: $(${cc}/bin/cc --version)" echo "ghc: $(${ghc}/bin/ghc --version)" echo "cabal: $(${cabal}/bin/cabal --version)" + echo "llc: $(${llvm}/bin/llc --version | head -2 | tail -1)" ''; }; } diff --git a/ppad-ripemd160.cabal b/ppad-ripemd160.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: ppad-ripemd160 -version: 0.1.3 +version: 0.1.4 synopsis: The RIPEMD-160 hashing algorithm. 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 implementation of RIPEMD-160 and HMAC-RIPEMD160 on strict and