1 unstable release
0.1.3 | Oct 11, 2022 |
---|
#4 in #tweetnacl
14KB
113 lines
tweetnacl-rs
re-export from sodalite.
Usage
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);
}
LICENSE
Dependencies
~6MB
~120K SLoC