Closed gz-c closed 5 years ago
The use of strings.Fields in splitMnemonicWords allow more than one whitespace character between words.
strings.Fields
splitMnemonicWords
https://golang.org/pkg/strings/#Fields
Fields splits the string s around each instance of one or more consecutive white space characters, as defined by unicode.IsSpace
The bip39 spec is not explicit about how words are to be separated.
The reference implementation uses a single space for the separator, after normalizing unicode to ascii:
https://github.com/trezor/python-mnemonic/blob/7d23efe34f3dd537996f31dae34f663207dac232/mnemonic/mnemonic.py#L153
Thanks for this report! This should be tightened up in the spec. I think until 2.0 is done with real native multi language support it makes sense to stick to single spaces. I'll change this.
The use of
strings.Fields
insplitMnemonicWords
allow more than one whitespace character between words.https://golang.org/pkg/strings/#Fields
The bip39 spec is not explicit about how words are to be separated.
The reference implementation uses a single space for the separator, after normalizing unicode to ascii:
https://github.com/trezor/python-mnemonic/blob/7d23efe34f3dd537996f31dae34f663207dac232/mnemonic/mnemonic.py#L153