everscale-crypto

Crates.ioeverscale-crypto
lib.rseverscale-crypto
version0.2.1
sourcesrc
created_at2022-02-13 20:41:44.434079
updated_at2024-04-25 16:59:58.215439
descriptionCryptography primitives for Everscale
homepage
repositoryhttps://github.com/broxus/everscale-crypto
max_upload_size
id531883
size21,379
Ivan Kalinin (Rexagon)

documentation

README

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);
}
Commit count: 19

cargo fmt