bip39/
lib.rs

1//!
2//! This is a Rust implementation of the [bip39][bip39-standard] standard for Bitcoin HD wallet
3//! mnemonic phrases.
4//!
5//!
6//! [bip39-standard]: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
7//!
8//! ## Quickstart
9//!
10//! ```rust
11//! use bip39::{Mnemonic, MnemonicType, Language, Seed};
12//!
13//! /// create a new randomly generated mnemonic phrase
14//! let mnemonic = Mnemonic::new(MnemonicType::Words12, Language::English);
15//!
16//! /// get the phrase
17//! let phrase: &str = mnemonic.phrase();
18//! println!("phrase: {}", phrase);
19//!
20//! /// get the HD wallet seed
21//! let seed = Seed::new(&mnemonic, "");
22//!
23//! // get the HD wallet seed as raw bytes
24//! let seed_bytes: &[u8] = seed.as_bytes();
25//!
26//! // print the HD wallet seed as a hex string
27//! println!("{:X}", seed);
28//! ```
29//!
30#[macro_use] extern crate failure;
31#[macro_use] extern crate once_cell;
32extern crate pbkdf2;
33extern crate hashbrown;
34extern crate sha2;
35extern crate hmac;
36
37mod mnemonic;
38mod error;
39mod mnemonic_type;
40mod language;
41mod util;
42mod seed;
43
44mod crypto;
45
46pub use language::Language;
47pub use mnemonic::Mnemonic;
48pub use mnemonic_type::MnemonicType;
49pub use seed::Seed;
50pub use error::ErrorKind;