Crates.io | tweetnacl-rs |
lib.rs | tweetnacl-rs |
version | 0.1.3 |
source | src |
created_at | 2019-05-23 21:40:28.637486 |
updated_at | 2019-05-27 13:40:58.286419 |
description | TweetNacl library, re-export from sodalite. |
homepage | https://github.com/clearloop/tweetnacl-rs |
repository | https://github.com/clearloop/tweetnacl-rs |
max_upload_size | |
id | 136503 |
size | 11,385 |
re-export from sodalite.
You can test the keypair in command line directly, for example:
$ cargo install tweetnacl-rs
$ tweetnacl-rs
tweetnacl-rs
============
Usage: tweetnacl-rs <Command> <args>
Commands:
gen <nil> => generate keypair
sign <message> <secretkey> => sign message
verify <message> <signature> <publickey> => verify message
$ tweetnacl-rs gen
public-key: "aa73d5a6c526bbad121a0c44d84cf31ae705bbadaf1221759a4da10e6d8fdcf1"
secret-key: "cb6e6713a8c2aba686b0ad4d7d914f1a9a31ee450a3d60b7d979131c045066a9aa73d5a6c526bbad121a0c44d84cf31ae705bbadaf1221759a4da10e6d8fdcf1"
Or your can use tweetnacl-rs
as a library:
use tweetnacl_rs::gen;
use tweetnacl_rs::TweetNacl;
fn main() {
let (pk, sk) = gen();
println!("public key: {:?}", pk);
println!("secret key: {:?}", sk.to_vec());
let sm = sk.sign("hello, world".to_string());
println!("signed message: {:?}", sm.to_vec());
let ret = pk.verify("hello, world".to_string(), &sm);
assert_eq!(ret, true);
}