Crate kyber_kem

Source
Expand description

Implementation of the Kyber IND-CCA2 secure key encapsulation mechanism (KEM)

Example usage:

use rand::rngs::OsRng;
use kyber_kem::{kem_keypair_1024, kem_encrypt_1024, kem_decrypt_1024};

let (secret_key, public_key) = kem_keypair_1024(&mut OsRng);
let (ciphertext, shared_secret) = kem_encrypt_1024(public_key, &mut OsRng);
let dec_shared_secret = kem_decrypt_1024(ciphertext, secret_key);
assert_eq!(shared_secret, dec_shared_secret);

Modules§

params
Library constants

Functions§

kem_decrypt_512
Takes a Kyber-512 ciphertext and a Kyber-512 secret key and returns a 32-byte shared secret.
kem_decrypt_768
Takes a Kyber-768 ciphertext and a Kyber-768 secret key and returns a 32-byte shared secret.
kem_decrypt_1024
Takes a Kyber-1024 ciphertext and a Kyber-1024 secret key and returns a 32-byte shared secret.
kem_encrypt_512
Takes a Kyber-512 public key as input and returns a ciphertext and a 32-byte shared secret.
kem_encrypt_768
Takes a Kyber-768 public key as input and returns a ciphertext and a 32-byte shared secret.
kem_encrypt_1024
Takes a Kyber-1024 public key as input and returns a ciphertext and a 32-byte shared secret.
kem_keypair_512
Returns a Kyber-512 secret key and a corresponding Kyber-512 public key.
kem_keypair_768
Returns a Kyber-768 secret key and a corresponding Kyber-768 public key.
kem_keypair_1024
Returns a Kyber-1024 secret key and a corresponding Kyber-1024 public key.