Skip to content

Simple implementation of Bitcoin's BIP39 mnemonic and seed generator

License

Notifications You must be signed in to change notification settings

eMaringolo/pharo-bip39mnemonic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

pharo-bip39mnemonic

Simple implementation of Bitcoin's BIP39 mnemonic and seed generator using the reference implementation as guide.

Personal disclaimer: This is a personal experimentation to learn by practice how the entropy, mnemonic, seeds, etc., works internally. It includes passing tests taken from the reference implementation as well (vectors, checksum, instantiation from different sources, languages, etc.).

Installation

Run:

Metacello new 
  baseline: 'BIP39Mnemonic'; 
  repository: 'github://eMaringolo/pharo-bip39mnemonic/src'; 
  load.

Examples

Creating a new one

| m |
"Creating a mnemonic from Pharo's weak PRNG" 
m := BIP39Mnemonic generate.

"Getting its mnemonic words"
m words. "#('argue' 'snap' 'this' 'common' 'cube' 'length'
            'abandon' 'abandon' 'abandon' 'abandon' 'abandon' 'ability')"

"Generating a seed with 
m seedForPassphrase: 'Pharo'.  "'154ad96ab7ad44d2c47beb3801e278b37b82fe9fc3...'"

Instantiating from existing words

BIP39Mnemonic fromWords: 'legal winner thank year wave sausage worth useful legal winner thank yellow'.

BIP39Mnemonic fromWords:  #('legal' 'winner' 'thank' 'year' 'wave' 'sausage' 
                             'worth' 'useful' 'legal' 'winner' 'thank' 'yellow')

About

Simple implementation of Bitcoin's BIP39 mnemonic and seed generator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published