Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3 #74

Closed
wants to merge 3 commits into from
Closed

Version 3 #74

wants to merge 3 commits into from

Conversation

dcousens
Copy link
Contributor

@dcousens dcousens commented Apr 14, 2018

@@ -61,12 +61,13 @@ function mnemonicToSeedHex (mnemonic, password) {
function mnemonicToEntropy (mnemonic, wordlist) {
wordlist = wordlist || DEFAULT_WORDLIST

var words = unorm.nfkd(mnemonic).split(' ')
var words = mnemonic.split(wordlist.separator)
Copy link
Contributor Author

@dcousens dcousens Apr 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fanatid was unorm being used here to normalize the separator? I don't think we need it [here] now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think we do not need unorm now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcousens This is not good. There is a possibility the user will input using normal spaces. (depending on which device/keyboard/IME they use)

normalizing beforehand fixed this, since both ASCII space and \u3000 space would both turn into ASCII space.

Your new method will fail if a Japanese user uses ASCII spaces for whatever reason.

Also, Japanese fails on new line 65 var index = wordlist.words.indexOf(word) because the wordlist is normalized strings but normal Japanese input is different String-wise (and Buffer-wise).

The normalize needs to stay, unfortunately... :-/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the normalized separator = ASCII space assumption is ever broken for a new wordlist we'd need to revisit this... maybe it needs a comment.

Also, the var index = wordlist.words.indexOf(word) actually is a "every language except English" problem, and not Japanese specifically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dabura667 I will restore the use of unorm here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like there needs to be a test for at least a japanese seed phrase

@dcousens dcousens requested review from dabura667 and fanatid and removed request for dabura667 April 14, 2018 05:13
This was referenced Apr 14, 2018
@fanatid
Copy link
Member

fanatid commented Apr 15, 2018

utACK

@@ -61,12 +61,13 @@ function mnemonicToSeedHex (mnemonic, password) {
function mnemonicToEntropy (mnemonic, wordlist) {
wordlist = wordlist || DEFAULT_WORDLIST

var words = unorm.nfkd(mnemonic).split(' ')
var words = mnemonic.split(wordlist.separator)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcousens This is not good. There is a possibility the user will input using normal spaces. (depending on which device/keyboard/IME they use)

normalizing beforehand fixed this, since both ASCII space and \u3000 space would both turn into ASCII space.

Your new method will fail if a Japanese user uses ASCII spaces for whatever reason.

Also, Japanese fails on new line 65 var index = wordlist.words.indexOf(word) because the wordlist is normalized strings but normal Japanese input is different String-wise (and Buffer-wise).

The normalize needs to stay, unfortunately... :-/

@dabura667
Copy link
Contributor

there are Japanese test cases linked in the BIP39 bip that I made.

@timhwang21
Copy link

@dcousens just wondering is anything missing for this PR to be released? Would be happy to help if so! Also as my primary concern is bundle size would you consider a smaller PR that adds ESM bundling and/or exports all functions in separate files to allow cherry picking imports? Thanks!

@wong2
Copy link

wong2 commented Nov 18, 2018

any progress?

@junderw
Copy link
Member

junderw commented Mar 5, 2019

Async is supported as a new method (backwards compatible) here: #100

@junderw
Copy link
Member

junderw commented Apr 2, 2019

Closing this in favor of #104

  1. Async was added Add Async method for converting to seed. #100
  2. Separation of wordlists was added to it Allow excluding wordlists when building for browserify #105

Separators are really not too necessary IMO... and as for removing HEX methods... yeah that makes sense.

I'll add these to the PR scope.

@junderw junderw closed this Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants