Crate kyber_rust

Source
Expand description

§Kyber-Rust

A Rust wrapper for the Kyber post-quantum key encapsulation mechanism.

This crate provides a safe Rust interface to the Kyber algorithm, which is a finalist in the NIST Post-Quantum Cryptography standardization process.

§Example

use kyber_rust::{generate_keypair, encapsulate, decapsulate};

// Generate a keypair
let (public_key, secret_key) = generate_keypair().unwrap();

// Encapsulate a shared secret
let (ciphertext, shared_secret_enc) = encapsulate(&public_key).unwrap();

// Decapsulate the shared secret
let shared_secret_dec = decapsulate(&ciphertext, &secret_key).unwrap();

// Verify that the shared secrets match
assert_eq!(shared_secret_enc, shared_secret_dec);

Constants§

CRYPTO_BYTES
CRYPTO_CIPHERTEXTBYTES
CRYPTO_PUBLICKEYBYTES
CRYPTO_SECRETKEYBYTES

Functions§

decapsulate
Decapsulates a shared secret using a ciphertext and a secret key.
encapsulate
Encapsulates a shared secret using a public key.
generate_keypair
Generates a Kyber keypair.