bip39 icon indicating copy to clipboard operation
bip39 copied to clipboard

translation between languages

Open MacroUniverse opened this issue 3 years ago • 4 comments

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. 分 岁 晚 肃 刚 谓 剑 昌 淡 案 施 送 铜 凤 福

MacroUniverse avatar May 30 '21 01:05 MacroUniverse

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.

iancoleman avatar May 30 '21 01:05 iancoleman

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?

MacroUniverse avatar May 30 '21 01:05 MacroUniverse

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

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!

Giszmo avatar Apr 17 '22 17:04 Giszmo