Skip to main content

encrypt_message

Function encrypt_message 

Source
pub fn encrypt_message<R>(
    ct: &mut [u8],
    ss: &mut [u8],
    pk: &[u8],
    _rng: &mut R,
    _seed: Option<&[u8]>,
) -> Result<(), KyberLibError>
where R: RngCore + CryptoRng,
Expand description

Generates cipher text and a shared secret for a given public key.

§Arguments

  • ct - Output cipher text (an already allocated array of CRYPTO_CIPHERTEXTBYTES bytes).
  • ss - Output shared secret (an already allocated array of CRYPTO_BYTES bytes).
  • pk - Input public key (an already allocated array of CRYPTO_PUBLICKEYBYTES bytes).
  • _rng - Random number generator implementing RngCore + CryptoRng.
  • _seed - Optional seed for random number generation.

§Errors

Returns a KyberLibError on failure.