#everscale #crypto

everscale-crypto

Cryptography primitives for Everscale

6 releases

Uses new Rust 2021

0.1.6 Jun 2, 2022
0.1.5 Jun 2, 2022
0.1.3 May 28, 2022
0.0.1 Feb 13, 2022

#858 in Magic Beans

Download history 66/week @ 2022-06-13 40/week @ 2022-06-20 45/week @ 2022-06-27 57/week @ 2022-07-04 54/week @ 2022-07-11 59/week @ 2022-07-18 56/week @ 2022-07-25 54/week @ 2022-08-01 85/week @ 2022-08-08 38/week @ 2022-08-15 60/week @ 2022-08-22 31/week @ 2022-08-29 50/week @ 2022-09-05 37/week @ 2022-09-12 26/week @ 2022-09-19 27/week @ 2022-09-26

143 downloads per month
Used in everscale-network

Custom license

17KB
368 lines

everscale-crypto   Latest Version everscale-crypto: rustc 1.56+ Workflow badge License MIT badge

Cryptography primitives for Everscale

Examples

use everscale_crypto::ed25519;

fn main() {    
    let data: &[u8] = b"hello world";

    let keys = ed25519::KeyPair::generate(&mut rand::thread_rng());
    
    // Simple bytes signature
    let signature = keys.sign_raw(data);
    assert!(keys.public_key.verify_raw(&data, &signature));
    
    // Sign TL data without intermediate serialization
    let signature = keys.sign(keys.public_key.as_tl());
    assert!(keys.public_key.verify(keys.public_key.as_tl(), &signature));

    // Shared secret
    let other_keys = ed25519::KeyPair::generate(&mut rand::thread_rng());
    let secret1 = keys.compute_shared_secret(&other_keys.public_key);
    let secret2 = other_keys.compute_shared_secret(&keys.public_key);
    assert_eq!(secret1, secret2);
}

Dependencies

~4MB
~90K SLoC