-
Notifications
You must be signed in to change notification settings - Fork 447
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
fix issue with 11 bit padding messing up checksum check. #33
Conversation
@dcousens the tests failed on 0.10 .. ?! |
I literally just saw that I as I pushed merge... I'm investigating it now |
thought there weren't any more v0.10 tests? or was that pbkdf2? |
@afk11 that was PBKDF2 ... which is probably why. |
yea PBKDF2 latest no longer works on 0.10, but I think you added the |
No, it's failing on https://github.com/bitcoinjs/bip39/blob/master/test/index.js#L173-L175 |
|
Oh wait, right. |
browserify/pbkdf2#36 (comment)
Of course, our repos. |
@dcousens yes drop |
@rubensayshi done |
also, this PR actually might have been too hasty, we just realized that the vector I added is 1028 bytes, while > 1024 bytes of entropy the imo there are 2 options:
I think 2 is sensible, but ... |
for now reversing the PR might be a good idea |
@rubensayshi I wasn't planning to release it for small while yet. I'm working through some examples locally. |
I think |
I'll try to figure out what the right solution is and let you know |
Yes 👍 It's unsupported now as of Oct 1st anyways. |
when experimenting with using BIP39 mnemonics for encoding non-standard entropy sizes we ran into some odd bug where
lpad(index, '0', 11)
was making the checksum check fail.this doesn't occur with the recommended BIP39 entropy sizes, but unless the library is made to limit it's scope completely to the recommended sizes (at which this bug doesn't occur) I think it should be fixed.
in
entropyToMnemonic
, thechunks
for thewords
we(entropy + checksum).chunk(11)
, this means the checksum can be split between chunks and the final chunk can be between 1 and 11 bits.in
mnemonicToEntropy
, thebits
from thewords
are padded to 11 bytes each and then we slice off thechecksum
which can contain a padding byte.by redoing the same step as in
entropyToMnemonic
and concatenatingentropy
withnewChecksum
we always get a comparable result.