Add Go implementation #686

pull dongri wants to merge 1 commits into bitcoin:master from hackerth:go-implementation changing 1 files +1 −0
  1. dongri commented at 2:44 PM on May 28, 2018: none

    I added a BIP39 Go implementation link.

  2. Add Go implementation 4179278c59
  3. dabura667 commented at 3:04 PM on May 28, 2018: none

    Your implementation is broken.

    1. Your tests don’t check the seed vectors.
    2. Your library doesn’t NFKD normalize.

    NACK

    Please fix for reconsideration.

  4. dongri commented at 3:30 PM on May 28, 2018: none

    https://github.com/dongri/go-mnemonic/commit/a6bb3ac443e0cf8522899e7076aeb9d659460704

    1. Fix Japanese word (NFKD normalize)
    2. Fix library apply NFKD normalize

    Please check

  5. dabura667 commented at 3:57 PM on May 28, 2018: none

    You need to NFKD normalize mnemonic and password for ToSeedHex before casting to a []byte()

  6. dabura667 commented at 4:06 PM on May 28, 2018: none

    Also chunksRe should be

    [01]{11}

    and not

    .{1,11}

  7. dongri commented at 4:38 PM on May 28, 2018: none
  8. dabura667 commented at 12:31 AM on May 29, 2018: none
    1. Using TREZOR as the passphrase for testing Japanese will not test NFKD. This is because norm.NFKD(“TREZOR”) == “TREZOR” (try it)

    So you should keep the passphrase used in the Japanese test vectors. (It is made so that norm.NFKD(passphrase) != passphrase

    Then your tests will make sure NFKD is used properly.

  9. dabura667 commented at 12:36 AM on May 29, 2018: none

    This is also why the Japanese test vectors are NOT pre-normalized.

    We want to test the NFKD is working correctly.

    :-)

  10. dongri commented at 2:25 AM on May 29, 2018: none

    @dabura667 Good morning!

    I change passphase "TREZOR" to "がちょう"

    Can test the NFKD is working https://github.com/dongri/go-mnemonic/blob/master/mnemonic_test.go#L58

  11. dabura667 commented at 3:47 PM on May 29, 2018: none

    One tiny nit-pick: binaryToByte should be binaryToInt since you return an int64 and not a []byte...

    Other than that, the vectors look good to me. I tested using apps I know to work and the entropy / mnemonic / seed for all the Japanese and English test vectors in your app passed.

    Also, I might prefer if you convert the wordlists into .go files rather than using the statik dependency.

    In general cryptocurrency libraries should avoid dependencies when at all possible.

    ie. https://github.com/bitpay/bitcore-mnemonic/blob/master/lib/words/japanese.js

    Maybe make a package called wordlists in /wordlists and have one go file for each language and make a struct like:

    // /wordlists/wordlist.go
    type Wordlist [2048]string
    
    // /wordlists/english.go
    const WordlistEnglish Wordlist = [2048]string{
      "aaa",
      "bbb",
      ...
      "zzz"
    }
    
    // /wordlists/french.go
    const WordlistFrench Wordlist = [2048]string{
      "aaa",
      "bbb",
      ...
      "zzz"
    }
    

    etc etc... (I am new to go, so if my syntax is wrong I am sorry.

  12. dongri commented at 4:44 PM on May 29, 2018: none

    @dabura667 Thank you advice I fixed func name, and remove statik dependency

    https://github.com/dongri/go-mnemonic/commit/dc9bfc04a038dd0e7245c783ccfca51a8a483bff

  13. dabura667 commented at 12:45 AM on May 30, 2018: none

    Looks great.

    ACK on adding it to the list of implementations.

  14. luke-jr added the label Proposed BIP modification on Jul 5, 2018
  15. luke-jr commented at 5:21 AM on July 5, 2018: member
  16. dongri commented at 12:32 PM on September 15, 2018: none

    @dabura667 Why don't you merge? Should I close it?

  17. dabura667 commented at 1:12 PM on September 15, 2018: none

    @dongri I don't have merge permissions. @luke-jr has merge permissions, and as a rule of thumb, there needs to be an ACK from the authors.

    Since this account is not associated with a known author, my ACK means nothing in regards to whether it is merged or not (though if enough of the people see me around and trust my judgements maybe eventually my ACK will be a sign that they don't need to check anything closely)

    Also, historically BIP39 pull requests are usually ignored since the original authors are busy with other things. (Especially new wordlists... but that's unrelated to this PR so I won't go off on a rant here)

    So you will probably wait for a while.

  18. dongri closed this on Apr 14, 2021


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me