bech32

Pure Haskell bech32, bech32m encodings (docs.ppad.tech/bech32).
git clone git://git.ppad.tech/bech32.git
Log | Files | Refs | README | LICENSE

commit 1e794cd35bbf902ad022c4f94546aa3e58ff22fc
parent 4ffe13796b5fb54e0c836c5068971f6021d4fe55
Author: Jared Tobin <jared@jtobin.io>
Date:   Fri,  3 Jan 2025 22:10:25 -0330

bench: accurate reference

Diffstat:
Mbench/Main.hs | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/bench/Main.hs b/bench/Main.hs @@ -47,7 +47,7 @@ bech32_decode = bgroup "bech32 decode" [ ] suite :: Benchmark -suite = env setup $ \ ~(a, b) -> bgroup "benchmarks" [ +suite = bgroup "benchmarks" [ bgroup "ppad-bech32" [ base32_encode , base32_decode @@ -56,14 +56,12 @@ suite = env setup $ \ ~(a, b) -> bgroup "benchmarks" [ ] , bgroup "reference" [ bgroup "bech32" [ - bench "120b" $ nf (R.bech32Encode "bc") a + bench "120b" $ nf (refEncode "bc") "jtobin was here" , bench "128b (non 40-bit multiple length)" $ - nf (R.bech32Encode "bc") b + nf (refEncode "bc") "jtobin was here!" ] ] ] where - setup = do - let a = R.toBase32 (BS.unpack "jtobin was here") - b = R.toBase32 (BS.unpack "jtobin was here!") - pure (a, b) + refEncode h a = R.bech32Encode h (R.toBase32 (BS.unpack a)) +