bech32

Pure Haskell bech32 and bech32m encodings.
git clone git://git.ppad.tech/bech32.git
Log | Files | Refs | README | LICENSE

commit f22c920f86cb54c786e0ae07a7b11821e1c4f17a
parent c0c5233bd3233fe5e52bb43eea0405299095d04c
Author: Jared Tobin <jared@jtobin.io>
Date:   Sat, 14 Dec 2024 04:17:10 -0330

lib: s/as_bech32/as_base32

Diffstat:
Mlib/Data/ByteString/Base32.hs | 5+++--
Mlib/Data/ByteString/Bech32.hs | 2+-
Mlib/Data/ByteString/Bech32m.hs | 2+-
3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/Data/ByteString/Base32.hs b/lib/Data/ByteString/Base32.hs @@ -7,6 +7,7 @@ module Data.ByteString.Base32 ( encode , as_word5 , as_bech32 + , as_base32 -- not actually base32-related, but convenient to put here , Encoding(..) @@ -152,8 +153,8 @@ as_word5 = BS.map f where Just w -> fi w -- naive word5 -> base32 -as_bech32 :: BS.ByteString -> BS.ByteString -as_bech32 = BS.map (BS.index bech32_charset . fi) +as_base32 :: BS.ByteString -> BS.ByteString +as_base32 = BS.map (BS.index bech32_charset . fi) polymod :: BS.ByteString -> Word32 polymod = BS.foldl' alg 1 where diff --git a/lib/Data/ByteString/Bech32.hs b/lib/Data/ByteString/Bech32.hs @@ -47,7 +47,7 @@ encode hrp (B32.encode -> dat) = do BSB.byteString hrp <> BSB.word8 49 -- 1 <> BSB.byteString dat - <> BSB.byteString (B32.as_bech32 check) + <> BSB.byteString (B32.as_base32 check) guard (BS.length res < 91) pure res diff --git a/lib/Data/ByteString/Bech32m.hs b/lib/Data/ByteString/Bech32m.hs @@ -47,7 +47,7 @@ encode hrp (B32.encode -> dat) = do BSB.byteString hrp <> BSB.word8 49 -- 1 <> BSB.byteString dat - <> BSB.byteString (B32.as_bech32 check) + <> BSB.byteString (B32.as_base32 check) guard (BS.length res < 91) pure res