Function pqc_kyber::encapsulate[][src]

pub fn encapsulate<R>(pk: &[u8], rng: &mut R) -> Encapsulated where
    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)?;