iancoleman / jsbip39

Mnemonic code for generating deterministic keys
111 stars 37 forks source link

Derive Mnemonic Phrase from Seed? #2

Closed woodser closed 6 years ago

woodser commented 6 years ago

Hi, thanks for your work on this. It's built well.

I'm wondering if there is a way to recover the mnemonic phrase from a hexadecimal string. Specifically, jsbip39.js:131 self.toSeed() generates a hexadecimal string. Is it possible to convert that back to the original mnemonic phrase?

Thanks!

woodser commented 6 years ago

Nice, I see that you are working on a BIP39 tool with Shamir's Secret Sharing. That is exactly what I'm intending to add to cryptostorage.com. I'll check out your code. This is great work, thanks.

iancoleman commented 6 years ago

I'm wondering if there is a way to recover the mnemonic phrase from a hexadecimal string

No, since the mnemonic is PBKDF2 (ie hashed) to get the seed. That hash cannot be reversed back into entropy / mnemonic.

If you like Shamir39 I recommend checking out SLIP-0039- Shamir's Secret-Sharing for Mnemonic Codes.

woodser commented 6 years ago

@iancoleman,

I have a branch of my tool which supports BIP39 mnemonic phrase generation, passphrase-protection, and splitting using Shamir's Secret Sharing and code from your repository.

It's using code from shamir39.js to convert between BIP39 mnemonic phrases and hexadecimals. The hexadecimal is used as input to Shamir's. I factored out two methods, Shamir39.getHexFromWords() and Shamir39.getWordsFromHex() specifically for this purpose. I think these methods are useful as standalone utilities.

The splitting feature is not currently using the draft specification for splitting BIP39 mnemonic phrases.

If you have feedback before I make this generally available, it's especially welcome and appreciated. Thanks.