Struct chain_vote::cryptography::zkps::unit_vector::zkp::Zkp
source · pub struct Zkp {
ibas: Vec<Announcement>,
ds: Vec<Ciphertext>,
zwvs: Vec<ResponseRandomness>,
r: Scalar,
}
Fields§
§ibas: Vec<Announcement>
Commitment to the proof randomness and bits of binary representaion of i
ds: Vec<Ciphertext>
Encryption to the polynomial coefficients used in the proof
zwvs: Vec<ResponseRandomness>
Response related to the randomness committed in ibas
r: Scalar
Final response
Implementations§
source§impl Zkp
impl Zkp
sourcepub(crate) fn generate<R: RngCore + CryptoRng>(
rng: &mut R,
crs: &Crs,
public_key: &PublicKey,
unit_vector: &UnitVector,
encryption_randomness: &[Scalar],
ciphertexts: &[Ciphertext]
) -> Self
pub(crate) fn generate<R: RngCore + CryptoRng>( rng: &mut R, crs: &Crs, public_key: &PublicKey, unit_vector: &UnitVector, encryption_randomness: &[Scalar], ciphertexts: &[Ciphertext] ) -> Self
Generate a unit vector proof. In this proof, a prover encrypts each entry of a
vector unit_vector
, and proves
that the vector is a unit vector. In particular, it proves that it is the i
th unit
vector without disclosing i
.
Common Reference String (Crs
): Pedersen Commitment Key
Statement: public key pk
, and ciphertexts ciphertexts
C_0=Enc_pk(r_0; v_0), …, C_{m-1}=Enc_pk(r_{m-1}; v_{m-1})
Witness: the unit vector unit_vector
, and randomness used for
encryption encryption_randomness
.
The proof communication complexity is logarithmic with respect to the size of the encrypted tuple. Description of the proof available in Figure 8.
sourcepub fn verify(
&self,
crs: &Crs,
public_key: &PublicKey,
ciphertexts: &[Ciphertext]
) -> bool
pub fn verify( &self, crs: &Crs, public_key: &PublicKey, ciphertexts: &[Ciphertext] ) -> bool
Verify a unit vector proof. The verifier checks that the plaintexts encrypted in ciphertexts
,
under public_key
represent a unit vector.
Common Reference String (crs
): Pedersen Commitment Key
Statement: public key pk
, and ciphertexts ciphertexts
C_0=Enc_pk(r_0; v_0), …, C_{m-1}=Enc_pk(r_{m-1}; v_{m-1})
Description of the verification procedure available in Figure 9.
sourcefn verify_statements(
&self,
public_key: &PublicKey,
commitment_key: &CommitmentKey,
ciphertexts: &Ptp<Ciphertext>,
challenge_x: &Scalar,
challenge_y: &Scalar
) -> bool
fn verify_statements( &self, public_key: &PublicKey, commitment_key: &CommitmentKey, ciphertexts: &Ptp<Ciphertext>, challenge_x: &Scalar, challenge_y: &Scalar ) -> bool
Final verification of the proof, that we compute in a single vartime multiscalar multiplication.
sourcepub fn from_buffer(codec: &mut Codec<&[u8]>) -> Result<Self, ReadError>
pub fn from_buffer(codec: &mut Codec<&[u8]>) -> Result<Self, ReadError>
Try to generate a Proof
from a buffer
sourcepub fn from_parts(
ibas: Vec<Announcement>,
ds: Vec<Ciphertext>,
zwvs: Vec<ResponseRandomness>,
r: Scalar
) -> Self
pub fn from_parts( ibas: Vec<Announcement>, ds: Vec<Ciphertext>, zwvs: Vec<ResponseRandomness>, r: Scalar ) -> Self
Constructs the proof structure from constituent parts.
Panics
The ibas
, ds
, and zwvs
must have the same length, otherwise the function will panic.
sourcepub fn ibas(&self) -> impl Iterator<Item = &Announcement>
pub fn ibas(&self) -> impl Iterator<Item = &Announcement>
Return an iterator of the announcement commitments
sourcepub fn announcments_group_elements(&self) -> Vec<GroupElement>
pub fn announcments_group_elements(&self) -> Vec<GroupElement>
Return announcement commitments group elements
sourcepub fn ds(&self) -> impl Iterator<Item = &Ciphertext>
pub fn ds(&self) -> impl Iterator<Item = &Ciphertext>
Return an iterator of the encryptions of the polynomial coefficients
sourcepub fn zwvs(&self) -> impl Iterator<Item = &ResponseRandomness>
pub fn zwvs(&self) -> impl Iterator<Item = &ResponseRandomness>
Return an iterator of the response related to the randomness
sourcepub fn response_randomness_group_elements(&self) -> Vec<Scalar>
pub fn response_randomness_group_elements(&self) -> Vec<Scalar>
Return an iterator of the response related to the randomness