bitpay / bitcore-mnemonic

BIP39 Mnemonics implemented for Bitcore
http://bitcore.io
MIT License
155 stars 212 forks source link

Add JA test vectors #38

Closed dabura667 closed 8 years ago

dabura667 commented 8 years ago

(Note: changed this PR to only contain JP test vectors)

This will add Japanese test vectors to the library.

dabura667 commented 8 years ago

Note: this PR requires #39 which is why it is failing.

braydonf commented 8 years ago

These vectors I believe originally came from: https://github.com/trezor/python-mnemonic/blob/master/vectors.json It may be useful to follow up upstream as well?

dabura667 commented 8 years ago

Yes, I created these using python by replacing existing code with Japanese (rather than adding supprt for multiple languages). Then I ran those tests manually against my own javascript implementation based off early versions of bip39 (bitcoinjs-lib), but again, no upstream support. https://bip32jp.github.io/english/

I just added Japanese in a pr to bip39 the other day. https://github.com/bitcoinjs/bip39/pull/24

I should also add the vectors to python-mnemonic.

braydonf commented 8 years ago

How did you produce the seed hex values?

Did you run python3 generate_vectors.py from https://github.com/trezor/python-mnemonic

dabura667 commented 8 years ago

I believe I just used the same as English.

braydonf commented 8 years ago

I was running https://github.com/bitpay/bitcore-mnemonic/pull/39 with vectors generated from python3 generate_vectors.py. Even though the vectors committed in the python-mnemonic repository only include English vectors, the script will also generate Japanese, and was able to get it to work with a few modifications. However I needed to replace the ideographic spaces that was generated with 0xe38080, and wasn't able to verify the toSeed() hex strings.

dabura667 commented 8 years ago

@braydonf thats because the generate_vectors uses passphrase TREZOR whereas mine use a japanese passphrase

braydonf commented 8 years ago

I tried using that one as well, and didn't have any luck.

dabura667 commented 8 years ago

@braydonf I just tried again, and suddenly forgot how to get python to cooperate with UTF-8...

I struggled for a while, and decided to quit. However, the vectors I have here I have verified against the python reference implementation... though I forget how I did it.

I even tried using a VM with Ubuntu, still was getting ASCII errors crying about \u3000...

braydonf commented 8 years ago

I used python3, and the generate_vectors.py worked (except for the ideographic space issues mentioned earlier), I had issues when trying to use python2.7.