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 9c6558f47d310f2f2d83dc291c904189cc8a5683
parent 36df4619b5aa32d840cba12b9b4d107ad8d89c92
Author: Jared Tobin <jared@jtobin.io>
Date:   Fri,  8 Nov 2024 14:47:35 +0400

bench: mul_wnaf

Diffstat:
Mbench/Main.hs | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/bench/Main.hs b/bench/Main.hs @@ -13,6 +13,7 @@ import qualified Crypto.Curve.Secp256k1 as S instance NFData S.Projective instance NFData S.Affine instance NFData S.ECDSA +instance NFData S.Context instance NFData S.Word256 main :: IO () @@ -20,6 +21,7 @@ main = defaultMain [ parse_point , add , mul + , mul_wnaf , derive_pub , schnorr , ecdsa @@ -73,6 +75,19 @@ mul = env setup $ \x -> setup = pure . S.parse_int256 $ B16.decodeLenient "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed" +mul_wnaf :: Benchmark +mul_wnaf = env setup $ \ ~(tex, x) -> + bgroup "mul_wnaf" [ + bench "2 G" $ nf (S.mul_wnaf tex) 2 + , bench "(2 ^ 255 - 19) G" $ nf (S.mul_wnaf tex) x + ] + where + setup = do + let !tex = S.precompute + !int = S.parse_int256 $ B16.decodeLenient + "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed" + pure (tex, int) + derive_pub :: Benchmark derive_pub = env setup $ \x -> bgroup "derive_pub" [