#tweetnacl #re-exports #key-pair #gen #sign #sodalite #tweet-nacl

bin+lib tweetnacl-rs

TweetNacl library, re-export from sodalite

4 releases

0.1.3 May 27, 2019
0.1.2 May 27, 2019
0.1.1 May 27, 2019
0.1.0 May 23, 2019

#1604 in Cryptography

Download history 4/week @ 2024-02-25 55/week @ 2024-03-31

55 downloads per month

MIT license

9KB
112 lines

tweetnacl-rs

Crates.io Crates.io LICENSE

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

MIT

Dependencies

~0.6–0.8MB
~12K SLoC