Crates.io | keypair-rs |
lib.rs | keypair-rs |
version | 0.1.1 |
source | src |
created_at | 2023-04-08 15:04:11.63571 |
updated_at | 2023-04-08 15:08:56.30599 |
description | Keypair secp256k1 with blake2b hashing, keypairs similar to ethereum |
homepage | |
repository | |
max_upload_size | |
id | 833627 |
size | 6,133 |
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.
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());
}