2016-08-18 05:53:24 -07:00
|
|
|
//! Bitcoin keys.
|
|
|
|
|
2016-09-19 06:39:57 -07:00
|
|
|
extern crate rand;
|
2018-08-09 08:13:43 -07:00
|
|
|
extern crate rustc_hex as hex;
|
2016-09-19 06:39:57 -07:00
|
|
|
#[macro_use]
|
|
|
|
extern crate lazy_static;
|
|
|
|
extern crate base58;
|
|
|
|
extern crate secp256k1;
|
|
|
|
extern crate bitcrypto as crypto;
|
|
|
|
extern crate primitives;
|
|
|
|
|
2016-08-16 09:00:26 -07:00
|
|
|
pub mod generator;
|
2016-12-15 07:03:59 -08:00
|
|
|
mod address;
|
|
|
|
mod display;
|
|
|
|
mod keypair;
|
2016-08-16 09:00:26 -07:00
|
|
|
mod error;
|
2016-09-19 06:39:57 -07:00
|
|
|
mod network;
|
2016-08-18 03:56:18 -07:00
|
|
|
mod private;
|
2016-08-20 09:06:04 -07:00
|
|
|
mod public;
|
2016-08-21 02:12:53 -07:00
|
|
|
mod signature;
|
2016-08-16 09:00:26 -07:00
|
|
|
|
2016-09-19 06:39:57 -07:00
|
|
|
pub use primitives::{hash, bytes};
|
|
|
|
|
2016-12-15 07:03:59 -08:00
|
|
|
pub use address::{Type, Address};
|
|
|
|
pub use display::DisplayLayout;
|
|
|
|
pub use keypair::KeyPair;
|
|
|
|
pub use error::Error;
|
|
|
|
pub use private::Private;
|
|
|
|
pub use public::Public;
|
|
|
|
pub use signature::{Signature, CompactSignature};
|
|
|
|
pub use network::Network;
|
2016-08-16 09:00:26 -07:00
|
|
|
|
2016-08-20 09:25:41 -07:00
|
|
|
use hash::{H160, H256};
|
2016-09-19 06:39:57 -07:00
|
|
|
|
2016-12-15 07:03:59 -08:00
|
|
|
/// 20 bytes long hash derived from public `ripemd160(sha256(public))`
|
2016-08-18 05:39:00 -07:00
|
|
|
pub type AddressHash = H160;
|
2016-12-15 07:03:59 -08:00
|
|
|
/// 32 bytes long secret key
|
2016-08-16 09:00:26 -07:00
|
|
|
pub type Secret = H256;
|
2016-12-15 07:03:59 -08:00
|
|
|
/// 32 bytes long signable message
|
2016-08-20 09:25:41 -07:00
|
|
|
pub type Message = H256;
|
2016-08-16 09:00:26 -07:00
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
pub static ref SECP256K1: secp256k1::Secp256k1 = secp256k1::Secp256k1::new();
|
|
|
|
}
|
|
|
|
|