pub struct CiphertextAlt<E: Pairing> {
pub X_r: E::G1Affine,
pub enc_chunks: Vec<E::G1Affine>,
pub commitment: E::G1Affine,
pub X_r_sum: E::G1Affine,
}Expand description
Ciphertext used with LegoGroth16 and the slightly modified SAVER protocol. See saver_legogroth16::protocol_2 for more
details.
Fields§
§X_r: E::G1Affine§enc_chunks: Vec<E::G1Affine>§commitment: E::G1Affine§X_r_sum: E::G1AffineImplementations§
Source§impl<E: Pairing> CiphertextAlt<E>
impl<E: Pairing> CiphertextAlt<E>
Sourcepub fn decrypt(
&self,
sk: &SecretKey<E::ScalarField>,
dk: impl Into<PreparedDecryptionKey<E>>,
g_i: &[E::G1Affine],
chunk_bit_size: u8,
) -> Result<(E::ScalarField, E::G1Affine)>
pub fn decrypt( &self, sk: &SecretKey<E::ScalarField>, dk: impl Into<PreparedDecryptionKey<E>>, g_i: &[E::G1Affine], chunk_bit_size: u8, ) -> Result<(E::ScalarField, E::G1Affine)>
Decrypt this ciphertext returning the plaintext and commitment to randomness
Sourcepub fn decrypt_given_pairing_powers(
&self,
sk: &SecretKey<E::ScalarField>,
dk: impl Into<PreparedDecryptionKey<E>>,
g_i: &[E::G1Affine],
chunk_bit_size: u8,
pairing_powers: &[Vec<PairingOutput<E>>],
) -> Result<(E::ScalarField, E::G1Affine)>
pub fn decrypt_given_pairing_powers( &self, sk: &SecretKey<E::ScalarField>, dk: impl Into<PreparedDecryptionKey<E>>, g_i: &[E::G1Affine], chunk_bit_size: u8, pairing_powers: &[Vec<PairingOutput<E>>], ) -> Result<(E::ScalarField, E::G1Affine)>
Same as Self::decrypt but takes pairing powers (see PreparedDecryptionKey::pairing_powers)
that can be precomputed for faster decryption
Sourcepub fn verify_commitment(
&self,
ek: impl Into<PreparedEncryptionKey<E>>,
gens: impl Into<PreparedEncryptionGens<E>>,
) -> Result<()>
pub fn verify_commitment( &self, ek: impl Into<PreparedEncryptionKey<E>>, gens: impl Into<PreparedEncryptionGens<E>>, ) -> Result<()>
Verify that the ciphertext correctly commits to the message
Sourcepub fn verify_decryption(
&self,
message: &E::ScalarField,
nu: &E::G1Affine,
chunk_bit_size: u8,
dk: impl Into<PreparedDecryptionKey<E>>,
g_i: &[E::G1Affine],
gens: impl Into<PreparedEncryptionGens<E>>,
) -> Result<()>
pub fn verify_decryption( &self, message: &E::ScalarField, nu: &E::G1Affine, chunk_bit_size: u8, dk: impl Into<PreparedDecryptionKey<E>>, g_i: &[E::G1Affine], gens: impl Into<PreparedEncryptionGens<E>>, ) -> Result<()>
Verify that the decrypted message corresponds to original plaintext in the ciphertext
Sourcepub fn verify_decryption_with_randomized_pairing_checker(
&self,
message: &E::ScalarField,
nu: &E::G1Affine,
chunk_bit_size: u8,
dk: impl Into<PreparedDecryptionKey<E>>,
g_i: &[E::G1Affine],
gens: impl Into<PreparedEncryptionGens<E>>,
pairing_checker: &mut RandomizedPairingChecker<E>,
) -> Result<()>
pub fn verify_decryption_with_randomized_pairing_checker( &self, message: &E::ScalarField, nu: &E::G1Affine, chunk_bit_size: u8, dk: impl Into<PreparedDecryptionKey<E>>, g_i: &[E::G1Affine], gens: impl Into<PreparedEncryptionGens<E>>, pairing_checker: &mut RandomizedPairingChecker<E>, ) -> Result<()>
Verify that the decrypted message corresponds to original plaintext in the ciphertext but using randomized pairing checker
pub fn decrypt_given_legogroth16_vk( &self, sk: &SecretKey<E::ScalarField>, dk: impl Into<PreparedDecryptionKey<E>>, snark_vk: &VerifyingKey<E>, chunk_bit_size: u8, ) -> Result<(E::ScalarField, E::G1Affine)>
pub fn verify_decryption_given_legogroth16_vk( &self, message: &E::ScalarField, chunk_bit_size: u8, nu: &E::G1Affine, dk: impl Into<PreparedDecryptionKey<E>>, snark_vk: &VerifyingKey<E>, gens: impl Into<PreparedEncryptionGens<E>>, ) -> Result<()>
Trait Implementations§
Source§impl<E: Pairing> CanonicalDeserialize for CiphertextAlt<E>
impl<E: Pairing> CanonicalDeserialize for CiphertextAlt<E>
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
The general deserialize method that takes in customization flags.
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Source§impl<E: Pairing> CanonicalSerialize for CiphertextAlt<E>
impl<E: Pairing> CanonicalSerialize for CiphertextAlt<E>
Source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>
The general serialize method that takes in customization flags.
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
Source§impl<E: Clone + Pairing> Clone for CiphertextAlt<E>
impl<E: Clone + Pairing> Clone for CiphertextAlt<E>
Source§fn clone(&self) -> CiphertextAlt<E>
fn clone(&self) -> CiphertextAlt<E>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<E: Eq + Pairing> Eq for CiphertextAlt<E>
Source§impl<E: PartialEq + Pairing> PartialEq for CiphertextAlt<E>
impl<E: PartialEq + Pairing> PartialEq for CiphertextAlt<E>
Source§fn eq(&self, other: &CiphertextAlt<E>) -> bool
fn eq(&self, other: &CiphertextAlt<E>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<E: Pairing> StructuralPartialEq for CiphertextAlt<E>
Source§impl<E: Pairing> Valid for CiphertextAlt<E>
impl<E: Pairing> Valid for CiphertextAlt<E>
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
Auto Trait Implementations§
impl<E> Freeze for CiphertextAlt<E>
impl<E> RefUnwindSafe for CiphertextAlt<E>
impl<E> Send for CiphertextAlt<E>
impl<E> Sync for CiphertextAlt<E>
impl<E> Unpin for CiphertextAlt<E>
impl<E> UnsafeUnpin for CiphertextAlt<E>
impl<E> UnwindSafe for CiphertextAlt<E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more