secp256k1

Pure Haskell Schnorr, ECDSA on the elliptic curve secp256k1 (docs.ppad.tech/secp256k1).
git clone git://git.ppad.tech/secp256k1.git
Log | Files | Refs | README | LICENSE

commit 831b713171dfbab98d0ff6ea0f40f5f4966761fc
parent b9a37a1d6a9f320eeb5c50466734bee7011a8c20
Author: Jared Tobin <jared@jtobin.io>
Date:   Mon, 22 Dec 2025 17:10:35 -0330

meta: compile ppad-sha256 with llvm flag

Diffstat:
MREADME.md | 30++++++++++++++++--------------
Mflake.lock | 14+++++++-------
Mflake.nix | 9+++++++--
3 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/README.md b/README.md @@ -64,28 +64,28 @@ bench` to run the benchmark suite): ``` benchmarking schnorr/sign_schnorr' (large) - time 48.80 μs (48.36 μs .. 49.33 μs) - 1.000 R² (0.999 R² .. 1.000 R²) - mean 48.45 μs (48.35 μs .. 48.70 μs) - std dev 493.2 ns (237.4 ns .. 904.2 ns) + time 43.34 μs (43.21 μs .. 43.47 μs) + 1.000 R² (1.000 R² .. 1.000 R²) + mean 43.21 μs (43.13 μs .. 43.30 μs) + std dev 280.8 ns (221.0 ns .. 357.9 ns) benchmarking schnorr/verify_schnorr' - time 99.57 μs (99.22 μs .. 99.93 μs) + time 94.57 μs (94.27 μs .. 94.90 μs) 1.000 R² (1.000 R² .. 1.000 R²) - mean 99.58 μs (99.36 μs .. 99.82 μs) - std dev 774.1 ns (684.9 ns .. 882.0 ns) + mean 94.13 μs (93.92 μs .. 94.38 μs) + std dev 777.4 ns (644.8 ns .. 925.8 ns) benchmarking ecdsa/sign_ecdsa' (large) - time 57.96 μs (57.69 μs .. 58.26 μs) + time 35.21 μs (35.11 μs .. 35.32 μs) 1.000 R² (1.000 R² .. 1.000 R²) - mean 57.72 μs (57.59 μs .. 57.87 μs) - std dev 485.2 ns (401.6 ns .. 609.9 ns) + mean 35.14 μs (35.09 μs .. 35.20 μs) + std dev 184.4 ns (135.9 ns .. 241.5 ns) benchmarking ecdsa/verify_ecdsa' - time 89.84 μs (89.56 μs .. 90.12 μs) + time 88.70 μs (88.44 μs .. 88.93 μs) 1.000 R² (1.000 R² .. 1.000 R²) - mean 89.74 μs (89.53 μs .. 89.95 μs) - std dev 690.5 ns (578.1 ns .. 873.0 ns) + mean 88.93 μs (88.75 μs .. 89.13 μs) + std dev 635.0 ns (517.3 ns .. 963.9 ns) benchmarking ecdh/ecdh (large) time 140.4 μs (140.0 μs .. 140.8 μs) @@ -95,7 +95,8 @@ bench` to run the benchmark suite): ``` Ensure you compile with the 'llvm' flag (and that [ppad-fixed][fixed] -has been compiled with the 'llvm' flag) for maximum performance. +and [ppad-sha256][sha256] have been compiled with the 'llvm' flag) for +maximum performance. ## Security @@ -240,3 +241,4 @@ to get a REPL for the main library. [csecp]: https://git.ppad.tech/csecp256k1 [noble]: https://github.com/paulmillr/noble-secp256k1 [fixed]: https://git.ppad.tech/fixed +[sha256]: https://git.ppad.tech/sha256 diff --git a/flake.lock b/flake.lock @@ -184,11 +184,11 @@ ] }, "locked": { - "lastModified": 1766353466, + "lastModified": 1766362512, "narHash": "sha256-uQ2PW6AuO5ihjQuaedKUjpCzXBNd+yrZWxQl7kz6QwE=", "ref": "master", - "rev": "602f5fbd031106b89b31bea5eddf1c0dc3b07148", - "revCount": 253, + "rev": "703e7e3659198a1ead37cb4b3e6dbcd995b8dd45", + "revCount": 255, "type": "git", "url": "git://git.ppad.tech/fixed.git" }, @@ -274,11 +274,11 @@ ] }, "locked": { - "lastModified": 1750583530, - "narHash": "sha256-elc+wo2v26SW9WWqZ+36nlrEHTCIotUbbPU0eeMaKLc=", + "lastModified": 1766435555, + "narHash": "sha256-ysN0iRuBLSQrgWU3rCFUyq0NvRpug6DTBRZSlWbmI1A=", "ref": "master", - "rev": "282fa90825bbc04c324c58186da473cb380d0fc2", - "revCount": 95, + "rev": "a4c17689cd66e1ef35c667914765cb24c9a4b305", + "revCount": 96, "type": "git", "url": "git://git.ppad.tech/sha256.git" }, diff --git a/flake.nix b/flake.nix @@ -59,7 +59,6 @@ llvm = pkgs.llvmPackages_15.llvm; base16 = ppad-base16.packages.${system}.default; - sha256 = ppad-sha256.packages.${system}.default; hmac-drbg = ppad-hmac-drbg.packages.${system}.default; fixed = ppad-fixed.packages.${system}.default; @@ -68,9 +67,15 @@ (hlib.enableCabalFlag fixed "llvm") [ llvm ]; + sha256 = ppad-sha256.packages.${system}.default; + sha256-llvm = + hlib.addBuildTools + (hlib.enableCabalFlag sha256 "llvm") + [ llvm ]; + hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { ppad-base16 = base16; - ppad-sha256 = sha256; + ppad-sha256 = sha256-llvm; ppad-hmac-drbg = hmac-drbg; ppad-fixed = fixed-llvm; ${lib} = new.callCabal2nix lib ./. {