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

Method init

proof_system/src/sub_protocols/saver.rs:111–147  ·  view source on GitHub ↗

Encrypt the message and create proof using SAVER. Then initialize 3 Schnorr proof of knowledge protocols

(
        &mut self,
        rng: &mut R,
        ck_comm_ct: &'a [E::G1Affine],
        ck_comm_chunks: &'a [E::G1Affine],
        ck_comm_combined: &'a [E::G1Affine],
        message: E::ScalarField

Source from the content-addressed store, hash-verified

109 /// Encrypt the message and create proof using SAVER. Then initialize 3 Schnorr proof of knowledge
110 /// protocols
111 pub fn init<R: RngCore>(
112 &mut self,
113 rng: &mut R,
114 ck_comm_ct: &'a [E::G1Affine],
115 ck_comm_chunks: &'a [E::G1Affine],
116 ck_comm_combined: &'a [E::G1Affine],
117 message: E::ScalarField,
118 blinding_combined_message: Option<E::ScalarField>,
119 ) -> Result<(), ProofSystemError> {
120 if self.ciphertext.is_some() {
121 return Err(ProofSystemError::SubProtocolAlreadyInitialized(self.id));
122 }
123 let snark_proving_key = self
124 .snark_proving_key
125 .ok_or(ProofSystemError::SaverSnarkProvingKeyNotProvided)?;
126
127 // Create ciphertext and the snark proof
128 let (ciphertext, randomness_enc, proof) = Encryption::encrypt_with_proof(
129 rng,
130 &message,
131 self.encryption_key,
132 snark_proving_key,
133 self.chunk_bit_size,
134 )?;
135
136 self.init_schnorr_protocols(
137 rng,
138 ck_comm_ct,
139 ck_comm_chunks,
140 ck_comm_combined,
141 message,
142 blinding_combined_message,
143 ciphertext,
144 randomness_enc,
145 proof,
146 )
147 }
148
149 pub fn init_with_ciphertext_and_proof<R: RngCore>(
150 &mut self,

Callers 2

newMethod · 0.45

Calls 1

Tested by

no test coverage detected