#ed25519 #everscale #signature #secret

everscale-crypto

Cryptography primitives for Everscale

12 releases

0.3.0 Nov 28, 2024
0.2.1 Apr 25, 2024
0.2.0 Jul 24, 2023
0.2.0-pre.1 Feb 3, 2023
0.0.1 Feb 13, 2022

#6 in #everscale

Download history 262/week @ 2024-12-09 137/week @ 2024-12-16 272/week @ 2024-12-23 72/week @ 2024-12-30 209/week @ 2025-01-06 254/week @ 2025-01-13 212/week @ 2025-01-20 136/week @ 2025-01-27 263/week @ 2025-02-03 278/week @ 2025-02-10 207/week @ 2025-02-17 197/week @ 2025-02-24 170/week @ 2025-03-03 317/week @ 2025-03-10 196/week @ 2025-03-17 146/week @ 2025-03-24

837 downloads per month
Used in 10 crates (5 directly)

Custom license

22KB
462 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

~2.5–4MB
~85K SLoC