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 4fe3998c0d94dea7e059602747413d5825e34330
parent 84eaa4264fe5e638004ea42d2dedbc2d12b1df91
Author: Jared Tobin <jared@jtobin.io>
Date:   Mon, 22 Dec 2025 19:06:05 -0330

meta: add llvm flag

Diffstat:
MREADME.md | 22+++++++++++-----------
Mflake.nix | 4++--
Mppad-ripemd160.cabal | 7+++++++
3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md @@ -58,25 +58,25 @@ Haddocks (API documentation, etc.) are hosted at The aim is best-in-class performance for pure, highly-auditable Haskell code. -Current benchmark figures on my mid-2020 MacBook Air look like (use +Current benchmark figures on my M4 Silicon MacBook Air look like (use `cabal bench` to run the benchmark suite): ``` benchmarking ppad-ripemd160/RIPEMD160 (32B input)/hash - time 786.6 ns (778.0 ns .. 796.7 ns) - 0.999 R² (0.999 R² .. 1.000 R²) - mean 778.6 ns (775.3 ns .. 784.2 ns) - std dev 13.85 ns (9.858 ns .. 22.05 ns) - variance introduced by outliers: 20% (moderately inflated) + time 244.2 ns (244.0 ns .. 244.4 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) benchmarking ppad-ripemd160/HMAC-RIPEMD160 (32B input)/hmac - time 2.933 μs (2.906 μs .. 2.974 μs) - 0.999 R² (0.999 R² .. 0.999 R²) - mean 3.002 μs (2.978 μs .. 3.022 μs) - std dev 74.97 ns (62.74 ns .. 89.91 ns) - variance introduced by outliers: 30% (moderately inflated) + time 836.1 ns (835.3 ns .. 837.0 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) ``` +Compile with the 'llvm' flag for maximum performance. + ## Security This library aims at the maximum security achievable in a diff --git a/flake.nix b/flake.nix @@ -25,6 +25,7 @@ pkgs = import nixpkgs { inherit system; }; hlib = pkgs.haskell.lib; + llvm = pkgs.llvmPackages_15.llvm; base16 = ppad-base16.packages.${system}.default; @@ -50,10 +51,9 @@ buildInputs = [ cabal cc + llvm ]; - inputsFrom = builtins.attrValues self.packages.${system}; - doBenchmark = true; shellHook = '' diff --git a/ppad-ripemd160.cabal b/ppad-ripemd160.cabal @@ -14,6 +14,11 @@ description: A pure implementation of RIPEMD-160 and HMAC-RIPEMD160 on strict and lazy ByteStrings. +flag llvm + description: Use GHC's LLVM backend. + default: False + manual: True + source-repository head type: git location: git.ppad.tech/ripemd160.git @@ -23,6 +28,8 @@ library hs-source-dirs: lib ghc-options: -Wall + if flag(llvm) + ghc-options: -fllvm -O2 exposed-modules: Crypto.Hash.RIPEMD160 build-depends: