-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit ENT to 128-256, multiple of 4 (cont.) #49
Conversation
index.js
Outdated
throw new Error('Invalid mnemonic') | ||
} | ||
if (bits.length < 128) throw new Error(INVALID_MNEMONIC) | ||
if (bits.length > 264) throw new Error(INVALID_MNEMONIC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubensayshi I haven't got time to check, but why does a 24-word mnemonic decode to 264 bits of ENT bits?
index.js
Outdated
throw new Error('Invalid entropy') | ||
} | ||
// multiple of 4 | ||
if (entropyHex.length % 8 !== 0) throw new Error(INVALID_ENTROPY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boo hex
@@ -90,6 +99,7 @@ function entropyToMnemonic (entropy, wordlist) { | |||
|
|||
function generateMnemonic (strength, rng, wordlist) { | |||
strength = strength || 128 | |||
if (strength % 32 !== 0) throw new TypeError(INVALID_ENTROPY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really needed here, would be caught by entropyToMnemonic
, alas lets save the RNG some time?
Will release as a patch, simply because the BIP was updated as if it were a patch...