-
Notifications
You must be signed in to change notification settings - Fork 73
Description
The JavaScript npm implementation of BIP39 allows word counts divisible by 3:
https://github.com/bitcoinjs/bip39/blob/5faee2c17b2195f30b03cb125df68c20d7dd584b/src/index.js#L72
Same in the Python reference implementation linked from the BIP0039 wiki page:
https://github.com/trezor/python-mnemonic/blob/75629ff0e1a2dec7fbb3aa2c70a964c9023db5b4/src/mnemonic/mnemonic.py#L129
Real life example: The Yorio wallet for Cardano uses 15 words.
So this should be changed as well in this code:
https://github.com/rust-bitcoin/rust-bip39/blob/master/src/lib.rs
Looks like there are 2 occurrences of % 6. This should be refactored to a constant, and probably % 3, so that it is the same as in the npm library, or testing for the fixed set [12, 15, 18, 21, 24], as used in the Python reference implementation.