| Crates.io | chie-crypto |
| lib.rs | chie-crypto |
| version | 0.1.0 |
| created_at | 2026-01-18 13:49:42.736469+00 |
| updated_at | 2026-01-18 13:49:42.736469+00 |
| description | Cryptographic primitives for CHIE Protocol |
| homepage | |
| repository | https://github.com/cool-japan/chie |
| max_upload_size | |
| id | 2052370 |
| size | 1,670,091 |
Cryptographic primitives for the CHIE Protocol.
This crate provides all cryptographic operations required by CHIE Protocol:
Authenticated encryption for content protection.
use chie_crypto::{encrypt, decrypt, generate_key, generate_nonce};
let key = generate_key(); // 256-bit key
let nonce = generate_nonce(); // 96-bit nonce
let ciphertext = encrypt(plaintext, &key, &nonce)?;
let decrypted = decrypt(&ciphertext, &key, &nonce)?;
Why ChaCha20-Poly1305?
Digital signatures for bandwidth proof authentication.
use chie_crypto::{KeyPair, verify};
let keypair = KeyPair::generate();
let signature = keypair.sign(message);
let public_key = keypair.public_key();
// Verification (returns Result)
verify(&public_key, message, &signature)?;
Why Ed25519?
Fast cryptographic hashing for content integrity.
use chie_crypto::{hash, hash_multi, verify_hash};
let h = hash(data); // Single buffer
let h = hash_multi(&[chunk1, chunk2, chunk3]); // Streaming
assert!(verify_hash(data, &h));
Why BLAKE3?
The bandwidth proof protocol uses dual signatures:
nonce || chunk_hash || requester_pubkeynonce || chunk_hash || provider_pubkey || provider_sigThis prevents:
| Module | Purpose |
|---|---|
encryption.rs |
ChaCha20-Poly1305 AEAD encryption |
signing.rs |
Ed25519 digital signatures |
hash.rs |
BLAKE3 cryptographic hashing |
kdf.rs |
HKDF key derivation |
ct.rs |
Constant-time comparison utilities |
streaming.rs |
Streaming encryption for large files |
keyserde.rs |
Key serialization (PEM, hex, base64) |
rotation.rs |
Key rotation utilities |
chacha20poly1305 = "0.10"
ed25519-dalek = "2"
blake3 = "1"
rand = "0.9"
hkdf = "0.12"
sha2 = "0.10"