Closed pinheadmz closed 3 years ago
This branch now imports libtorsion from https://github.com/bcoin-org/libtorsion/pull/1 which is libtorsion current master branch plus the bech32 commit. Libtorsion has gone through a lot of changes since it was last imported and a good deal of the API expected by bcrypto was broken. All those fixes are in the last commit: https://github.com/bcoin-org/bcrypto/pull/61/commits/dc61f9d97fe92215f99ae7f9ebdeb8ea331117af
Sources:
BIP 173 (bech32)
BIP 350 (bech32m)
secp256k1
/ECDSA
in the module exposure, i.e. bech32 is now a class whose constructor accepts an argumentchecksum
(this is the only difference between bech32 and bech32m encodings, besides when they are used)0x50
was confused for its decimal equivalent (80
) which became0x80
. Looks to me like the test vectors from BIP173 were copied to bcrypto and then modified to pass the incorrect test. Luckily the real production logic for this is correct, in bcoin: https://github.com/bcoin-org/bcoin/blob/950e30c084141e7c8cb81233136b9e5bc7e1e02c/lib/script/script.js#L1592