Skip to content
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

Merged
merged 11 commits into from
May 23, 2017
Merged

Limit ENT to 128-256, multiple of 4 (cont.) #49

merged 11 commits into from
May 23, 2017

Conversation

dcousens
Copy link
Contributor

@dcousens dcousens commented May 12, 2017

Will release as a patch, simply because the BIP was updated as if it were a patch...

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)
Copy link
Contributor Author

@dcousens dcousens May 12, 2017

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)
Copy link
Contributor Author

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)
Copy link
Contributor Author

@dcousens dcousens May 12, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant