bip39

BIP39 mnemonic codes in Haskell (docs.ppad.tech/bip39).
git clone git://git.ppad.tech/bip39.git
Log | Files | Refs | README | LICENSE

commit 3c1cb68e45ec6dde4000ed44e4a6e607f89b26f1
parent 7fa6968542ee4eee069d143be49570af43b6d20b
Author: Jared Tobin <jared@jtobin.io>
Date:   Thu, 27 Feb 2025 16:38:21 +0400

lib: passphrase must also be nfkd utf8

Diffstat:
Mlib/Crypto/KDF/BIP39.hs | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Crypto/KDF/BIP39.hs b/lib/Crypto/KDF/BIP39.hs @@ -92,9 +92,9 @@ words wlist bs = L.unfoldr coalg (bs, 0, 0) where {-# INLINE words #-} -- XX check that this is a valid mnemonic! -seed :: T.Text -> BS.ByteString -> BS.ByteString +seed :: T.Text -> T.Text -> BS.ByteString seed mnem pass = PBKDF.derive SHA512.hmac bs salt 2048 64 where - salt = "mnemonic" <> pass + salt = TE.encodeUtf8 ("mnemonic" <> ICU.nfkd pass) bs = TE.encodeUtf8 (ICU.nfkd mnem) -- wordlists ------------------------------------------------------------------