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
- Generate random sigma
- Derive encryption randomness r = H3(sigma || message)
- Create commitment U = r * G
- Mask sigma with the pairing result
- Mask the message with H4(sigma)
§Arguments
rng
- Random number generatorpublic
- Master public keytarget
- Payload over which a signature will decrypt the messagemessage
- Message to encrypt
§Returns
Ciphertext<V>
- The encrypted ciphertext