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

Add 7 languages from the bip39 spec #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ A golang implementation of the BIP0039 spec for mnemonic seeds

## Credits

English wordlist and test vectors are from the standard Python BIP0039 implementation
from the Trezor guys: [https://github.com/trezor/python-mnemonic](https://github.com/trezor/python-mnemonic)
Wordlists are from the [bip39 spec](https://github.com/bitcoin/bips/tree/master/bip-0039).

Test vectors are from the standard Python BIP0039 implementation from the
Trezor guys: [https://github.com/trezor/python-mnemonic](https://github.com/trezor/python-mnemonic)

## Example

Expand Down
14 changes: 13 additions & 1 deletion bip39.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,26 @@ import (
"golang.org/x/crypto/pbkdf2"
)

// Some bitwise operands for working with big.Ints
var (
// Some bitwise operands for working with big.Ints
Last11BitsMask = big.NewInt(2047)
RightShift11BitsDivider = big.NewInt(2048)
BigOne = big.NewInt(1)
BigTwo = big.NewInt(2)

// Wordlist sets the language used for the mnemonic
WordList = EnglishWordList

// ReverseWordMap is a reverse lookup of Wordlist
ReverseWordMap = map[string]int{}
)

func init() {
for i, v := range WordList {
ReverseWordMap[v] = i
}
}

// NewEntropy will create random entropy bytes
// so long as the requested size bitSize is an appropriate size.
func NewEntropy(bitSize int) ([]byte, error) {
Expand Down
Loading