Crates.io | zeronet_cryptography |
lib.rs | zeronet_cryptography |
version | 0.1.9 |
source | src |
created_at | 2021-06-27 23:36:15.896193 |
updated_at | 2021-12-29 00:24:09.733557 |
description | ZeroNet cryptocraphy helper library |
homepage | http://www.github.com/Anshorei/zeronet_cryptography |
repository | http://www.github.com/Anshorei/zeronet_cryptography |
max_upload_size | |
id | 415548 |
size | 15,198 |
A rust cryptography interface for ZeroNet/zerunet.
This library is a part of the zerunet project. It has been split from the main project because it could be useful to build programs that have to sign data that ZN clients will consider valid.
Due to bitcoin-rs not having been updated for secp256k1 v0.17.2, the dependency has been replaced with an updated crate in the cratez repository. When the dependencies on the bitcoin crate are resolved this change can be undone.
Zerucrypt has not been benchmarked yet. If you'd like to help: contact Ansho Rei (anshorei@zeroid.bit) on ZeroMe or ZeroMail!
use zerucrypt::verify;
let data = "Testmessage";
let address = "1HZwkjkeaoZfTSaJxDw6aKkxp45agDiEzN";
let signature = "G+Hnv6dXxOAmtCj8MwQrOh5m5bV9QrmQi7DSGKiRGm9TWqWP3c5uYxUI/C/c+m9+LtYO26GbVnvuwu7hVPpUdow=";
match verify(data, address, signature) {
Ok(_) => println!("Signature is a valid."),
Err(_) => println!("Signature is invalid."),
}
use zerucrypt::sign;
let data = "Testmessage";
let private_key = "5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss";
match sign(data, private_key) {
Ok(signature) => println!("The signature is {}", signature),
Err(_) => println!("An error occured during the signing process"),
}
use zerucrypt::create;
let (priv_key, pub_key) = create();