Function pqc_kyber::encapsulate

source ·
pub fn encapsulate<R>(pk: &[u8], rng: &mut R) -> Encapsulatedwhere
    R: CryptoRng + RngCore,
Expand description

Encapsulates a public key returning the ciphertext to send and the shared secret

Example

let mut rng = rand::thread_rng();
let keys = keypair(&mut rng);
let (ciphertext, shared_secret) = encapsulate(&keys.public, &mut rng)?;