bitpay / bitcore-mnemonic

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

Mnemonic from <-> to #68

Open speculees opened 5 years ago

speculees commented 5 years ago

Hi, I have a question. I create Mnemonic from some String. I then call toSeed() method and I get a Buffer. Afterwards, I create a new Mnemonic using the same Buffer generated by toSeed method. I call toHDPrivateKey().privateKey.toWIF() on both Mnemonics and I get two different results. Why is this? It seems if I pass String or Buffer to Mnemonic constructor the result should be the same, yet it's not.

speculees commented 5 years ago

And here is the code example:

var Mnemonic = require('bitcore-mnemonic'); var bitcore = require('bitcore-lib');

var wordPhrase = 'concert great autumn belt diagram page rigid stereo draw comfort goat zone'; var mnemonicCode1 = new Mnemonic(wordPhrase); var bufferSeed = mnemonicCode1.toSeed(); var mnemonicCode2 = new Mnemonic(bufferSeed);

console.log(mnemonicCode1.phrase); // output: concert great autumn belt diagram page rigid stereo draw comfort goat zone console.log(mnemonicCode2.phrase); // output: volcano suspect marriage delay focus spring firm message add lizard royal board yard daughter online robust wonder help review gospel between convince truck trumpet trim tackle term unique depart solve border rather gap aware ball electric ask faint open heavy direct cause noise fee picnic cheap illness museum

speculees commented 5 years ago

Oh yeah. I know there is fromSeed function, but It just checks if params are correct type before passing them to the return new Mnemonic(seed, wordlist);