| Crates.io | tycho-crypto |
| lib.rs | tycho-crypto |
| version | 0.4.0 |
| created_at | 2025-06-26 11:35:01.390621+00 |
| updated_at | 2025-06-26 11:35:01.390621+00 |
| description | Cryptography primitives for Tycho node |
| homepage | |
| repository | https://github.com/broxus/tycho-crypto |
| max_upload_size | |
| id | 1727181 |
| size | 47,106 |
Cryptography primitives for Tycho
use tycho_crypto::ed25519;
fn main() {
let data: &[u8] = b"hello world";
let keys = rand::random::<ed25519::KeyPair>();
// 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_tl(keys.public_key.as_tl());
assert!(keys.public_key.verify_tl(keys.public_key.as_tl(), &signature));
// Shared secret
let other_keys = rand::random::<ed25519::KeyPair>();
let secret1 = keys.compute_shared_secret(&other_keys.public_key);
let secret2 = other_keys.compute_shared_secret(&keys.public_key);
assert_eq!(secret1, secret2);
}
We welcome contributions to the project! If you notice any issues or errors, feel free to open an issue or submit a pull request.
Licensed under either of
at your option.