BIP39 says > The allowed size of ENT is 128-256 bits. Once we add the checksum this is 132-264 bits. This is divided by 11 to get the word count. From the BIP141 ``` CS = ENT / 32 MS = (ENT + CS) / 11 | ENT | CS | ENT+CS | MS | +-------+----+--------+------+ | 128 | 4 | 132 | 12 | | 160 | 5 | 165 | 15 | | 192 | 6 | 198 | 18 | | 224 | 7 | 231 | 21 | | 256 | 8 | 264 | 24 | ``` Currently we are limiting word count to be a multiple of 6, I do not know why this is being done but from reading the BIP it seems that 15 is a valid word count value. Allow word count of 15 by checking the word count modulo 3 instead of modulo 6. Since this check appears twice in the code, add a helper function to reduce code duplication. Fixes: #15 |
||
---|---|---|
benches | ||
src | ||
.editorconfig | ||
.gitignore | ||
.rustfmt.toml | ||
.travis.yml | ||
CHANGELOG.md | ||
Cargo.toml | ||
LICENSE | ||
README.md |
README.md
bip39
A Rust implementation of BIP-39 mnemonic codes.
Word lists (languages)
We support all languages specified in the BIP-39 standard as of writing.
The English language is always loaded and other languages can be loaded using the corresponding feature.
Use the all-languages
feature to enable all languages.
- English (always enabled)
- Simplified Chinese (
chinese-simplified
) - Traditional Chinese (
chinese-traditional
) - Czech (
czech
) - French (
french
) - Italian (
italian
) - Japanese (
japanese
) - Korean (
korean
) - Spanish (
spanish
)
MSRV
This crate supports Rust v1.29 and up and works with no_std
.