encrypt

Function encrypt 

Source
pub fn encrypt<R: CryptoRngCore, V: Variant>(
    rng: &mut R,
    public: V::Public,
    target: (Option<&[u8]>, &[u8]),
    message: &Block,
) -> Ciphertext<V>
Expand description

Encrypt a message for a given target.

§Steps

  1. Generate random sigma
  2. Derive encryption randomness r = H3(sigma || message)
  3. Create commitment U = r * G
  4. Mask sigma with the pairing result
  5. Mask the message with H4(sigma)

§Arguments

  • rng - Random number generator
  • public - Master public key
  • target - Payload over which a signature will decrypt the message
  • message - Message to encrypt

§Returns

  • Ciphertext<V> - The encrypted ciphertext