2 releases
0.1.1 | Apr 8, 2023 |
---|---|
0.1.0 | Apr 8, 2023 |
#67 in #key-pair
7KB
102 lines
KeyPair-rs
Keypair-rs is simple rust library for generating keypairs like used in ethreum. It is based on the sec256k1 library. For hashing it uses the blake2b algorithm.
Usage
use keypair::Keypair;
fn main() {
let keypair = Keypair::generate();
println!("public_key: {:?}", keypair.public_key);
println!("private_key: {:?}", keypair.private_key);
println!("address: {:?}", keypair.address());
let message = "hello world".to_string();
let signature = keypair.sign(message.clone()).unwrap();
println!("signature: {:?}", signature);
assert!(keypair.verify(&message, &signature).unwrap());
}
Dependencies
~6MB
~69K SLoC