MCPcopy Create free account
hub / github.com/docknetwork/crypto / decrypt

Method decrypt

saver/src/encryption.rs:289–299  ·  view source on GitHub ↗

Decrypt the given ciphertext and return the message and a "commitment" to randomness to help in verifying the decryption without knowledge of secret key. This is "Dec" from algorithm 2 in the paper

(
        c_0: &E::G1Affine,
        c: &[E::G1Affine],
        sk: &SecretKey<E::ScalarField>,
        dk: impl Into<PreparedDecryptionKey<E>>,
        g_i: &[E::G1Affine],
        chunk_bit_size: u8

Source from the content-addressed store, hash-verified

287 /// Decrypt the given ciphertext and return the message and a "commitment" to randomness to help in
288 /// verifying the decryption without knowledge of secret key. This is "Dec" from algorithm 2 in the paper
289 pub fn decrypt(
290 c_0: &E::G1Affine,
291 c: &[E::G1Affine],
292 sk: &SecretKey<E::ScalarField>,
293 dk: impl Into<PreparedDecryptionKey<E>>,
294 g_i: &[E::G1Affine],
295 chunk_bit_size: u8,
296 ) -> crate::Result<(E::ScalarField, E::G1Affine)> {
297 let (chunks, nu) = Self::decrypt_to_chunks(c_0, c, sk, dk, g_i, chunk_bit_size)?;
298 Ok((utils::compose(&chunks, chunk_bit_size)?, nu))
299 }
300
301 /// Same as `Self::decrypt` but expects pairing powers (see `PreparedDecryptionKey::pairing_powers`)
302 /// that can be precomputed for even faster decryption

Callers 2

checkFunction · 0.45

Calls 1

composeFunction · 0.85

Tested by

no test coverage detected