#bip39 #bitcoin #mnemonic

tiny-bip39

A fork of the bip39 crate with fixes to v0.6. Rust implementation of BIP-0039

7 releases

0.7.3 Mar 27, 2020
0.7.2 Mar 19, 2020
0.7.1 Feb 26, 2020
0.7.0 Jan 10, 2020
0.6.0 Feb 20, 2019

#16 in Cryptocurrencies

Download history 6039/week @ 2020-04-12 7274/week @ 2020-04-19 6160/week @ 2020-04-26 5967/week @ 2020-05-03 7219/week @ 2020-05-10 6223/week @ 2020-05-17 5991/week @ 2020-05-24 6287/week @ 2020-05-31 6580/week @ 2020-06-07 6269/week @ 2020-06-14 6277/week @ 2020-06-21 6780/week @ 2020-06-28 7076/week @ 2020-07-05 6164/week @ 2020-07-12 7552/week @ 2020-07-19 7294/week @ 2020-07-26

14,129 downloads per month
Used in 154 crates (13 directly)

MIT/Apache

84KB
942 lines

tiny-bip39

This is a fork of the bip39 crate with fixes for v0.6.

Changes

See the changelog file, or the Github releases for specific tags.

Documentation

Add bip39 to your Cargo file, and then refer to the documentation for use.

Only an English wordlist is included at the moment, but support for other languages is already present in the code.

A set of simple tests have been written but they only generate new mnemonics and validate a selection of known valid mnemonics generated by other tools


lib.rs:

This is a Rust implementation of the bip39 standard for Bitcoin HD wallet mnemonic phrases.

Quickstart

use bip39::{Mnemonic, MnemonicType, Language, Seed};

/// create a new randomly generated mnemonic phrase
let mnemonic = Mnemonic::new(MnemonicType::Words12, Language::English);

/// get the phrase
let phrase: &str = mnemonic.phrase();
println!("phrase: {}", phrase);

/// get the HD wallet seed
let seed = Seed::new(&mnemonic, "");

// get the HD wallet seed as raw bytes
let seed_bytes: &[u8] = seed.as_bytes();

// print the HD wallet seed as a hex string
println!("{:X}", seed);

Dependencies

~2MB
~50K SLoC