iancoleman / bip39

A web tool for converting BIP39 mnemonic codes
https://iancoleman.io/bip39/
MIT License
3.42k stars 1.42k forks source link

translation between languages #504

Open MacroUniverse opened 3 years ago

MacroUniverse commented 3 years ago

Hi, when I convert between different languages, the results are different even if they have exact correspondence (having the same index in the word list). Why is that?

My example:

  1. advance isolate guilt riot grow guard walk nurse pizza ecology earn erupt manage slogan horn
  2. 分 岁 晚 肃 刚 谓 剑 昌 淡 案 施 送 铜 凤 福
iancoleman commented 3 years ago

https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed

To create a binary seed from the mnemonic, we use the PBKDF2 function with a mnemonic sentence (in UTF-8 NFKD) used as the password and the string "mnemonic" + passphrase (again in UTF-8 NFKD) used as the salt.

The words are hashed to get the seed. So different words give different seeds. Even if the words come from the same underlying entropy.

MacroUniverse commented 3 years ago

https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed

To create a binary seed from the mnemonic, we use the PBKDF2 function with a mnemonic sentence (in UTF-8 NFKD) used as the password and the string "mnemonic" + passphrase (again in UTF-8 NFKD) used as the salt.

The words are hashed to get the seed. So different words give different seeds. Even if the words come from the same underlying entropy.

Thanks. So is there no way one can convert BIP 39 from one language to another and generate the same result?

wigy-opensource-developer commented 3 years ago

Unfortunately it is the words themselves and not the entropy that gets hashed. So no, there is no way.

Giszmo commented 2 years ago

I am shocked to learn this! So supporting chinese breaks compatibility with almost all other wallets out there? Why did the BIP authors decide to use the words instead of the indices???

Anyway, this tool here should not pretend it was any other way as it currently does "translate" by index ... sort of. When going from Spanish to English, words with an accent get replaced by an empty string.

Please add an alert, maybe linking to this issue when a user switches to anything but English.

We strongly suggest to use only English due to compatibility issues!