From 6ae54b2f8922f40b0fa0e76e8d1eba842d61ebfb Mon Sep 17 00:00:00 2001 From: aniampio Date: Thu, 4 Nov 2021 12:47:37 +0000 Subject: [PATCH] Remove old comment --- common/nymcoconut/src/proofs/mod.rs | 58 ++++++++++++++--------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/common/nymcoconut/src/proofs/mod.rs b/common/nymcoconut/src/proofs/mod.rs index 07dd3a4b8d..072223cba6 100644 --- a/common/nymcoconut/src/proofs/mod.rs +++ b/common/nymcoconut/src/proofs/mod.rs @@ -18,18 +18,18 @@ use std::borrow::Borrow; use std::convert::TryInto; use bls12_381::{G1Projective, G2Projective, Scalar}; -use digest::generic_array::typenum::Unsigned; use digest::Digest; +use digest::generic_array::typenum::Unsigned; use group::GroupEncoding; use itertools::izip; use sha2::Sha256; +use crate::{Attribute, elgamal, ElGamalKeyPair}; use crate::elgamal::Ciphertext; use crate::error::{CoconutError, Result}; use crate::scheme::setup::Parameters; use crate::scheme::VerificationKey; use crate::utils::{hash_g1, try_deserialize_scalar, try_deserialize_scalar_vec}; -use crate::{elgamal, Attribute, ElGamalKeyPair}; // as per the reference python implementation type ChallengeDigest = Sha256; @@ -51,10 +51,10 @@ pub struct ProofCmCs { // and as per the bls12-381 library all elements are using big-endian form /// Generates a Scalar [or Fp] challenge by hashing a number of elliptic curve points. fn compute_challenge(iter: I) -> Scalar -where - D: Digest, - I: Iterator, - B: AsRef<[u8]>, + where + D: Digest, + I: Iterator, + B: AsRef<[u8]>, { let mut h = D::new(); for point_representation in iter { @@ -82,8 +82,8 @@ fn produce_response(witness: &Scalar, challenge: &Scalar, secret: &Scalar) -> Sc // note: it's caller's responsibility to ensure witnesses.len() = secrets.len() fn produce_responses(witnesses: &[Scalar], challenge: &Scalar, secrets: &[S]) -> Vec -where - S: Borrow, + where + S: Borrow, { debug_assert_eq!(witnesses.len(), secrets.len()); @@ -150,10 +150,10 @@ impl ProofCmCs { // Ccm = (wr * g1) + (wm[0] * hs[0]) + ... + (wm[i] * hs[i]) let commitment_attributes = g1 * witness_commitment_opening + witness_attributes - .iter() - .zip(params.gen_hs().iter()) - .map(|(wm_i, hs_i)| hs_i * wm_i) - .sum::(); + .iter() + .zip(params.gen_hs().iter()) + .map(|(wm_i, hs_i)| hs_i * wm_i) + .sum::(); let ciphertexts_bytes = priv_attributes_ciphertexts .iter() @@ -244,19 +244,19 @@ impl ProofCmCs { self.response_keys.iter(), self.response_attributes.iter() ) - .map(|(c2, res_key, res_attr)| c2 * self.challenge + pub_key * res_key + h * res_attr) - .map(|witness| witness.to_bytes()) - .collect::>(); + .map(|(c2, res_key, res_attr)| c2 * self.challenge + pub_key * res_key + h * res_attr) + .map(|witness| witness.to_bytes()) + .collect::>(); // Cw = (cm * c) + (rr * g1) + (rm[0] * hs[0]) + ... + (rm[n] * hs[n]) let commitment_attributes = commitment * self.challenge + g1 * self.response_opening + self - .response_attributes - .iter() - .zip(params.gen_hs().iter()) - .map(|(res_attr, hs)| hs * res_attr) - .sum::(); + .response_attributes + .iter() + .zip(params.gen_hs().iter()) + .map(|(res_attr, hs)| hs * res_attr) + .sum::(); let ciphertexts_bytes = attributes_ciphertexts .iter() @@ -413,10 +413,10 @@ impl ProofKappaNu { let commitment_kappa = params.gen2() * witness_blinder + verification_key.alpha + witness_attributes - .iter() - .zip(verification_key.beta.iter()) - .map(|(wm_i, beta_i)| beta_i * wm_i) - .sum::(); + .iter() + .zip(verification_key.beta.iter()) + .map(|(wm_i, beta_i)| beta_i * wm_i) + .sum::(); // zeta is the public value associated with the serial number let commitment_zeta = params.gen2() * witness_serial_number; @@ -470,10 +470,10 @@ impl ProofKappaNu { + params.gen2() * self.response_blinder + verification_key.alpha * (Scalar::one() - self.challenge) + response_attributes - .iter() - .zip(verification_key.beta.iter()) - .map(|(priv_attr, beta_i)| beta_i * priv_attr) - .sum::(); + .iter() + .zip(verification_key.beta.iter()) + .map(|(priv_attr, beta_i)| beta_i * priv_attr) + .sum::(); // zeta is the public value associated with the serial number let commitment_zeta = zeta * self.challenge + params.gen2() * self.response_serial_number; @@ -482,7 +482,7 @@ impl ProofKappaNu { let challenge = compute_challenge::( std::iter::once(params.gen2().to_bytes().as_ref()) .chain(std::iter::once(kappa.to_bytes().as_ref())) - .chain(std::iter::once(zeta.to_bytes().as_ref())) //kappa + .chain(std::iter::once(zeta.to_bytes().as_ref())) .chain(std::iter::once(verification_key.alpha.to_bytes().as_ref())) .chain(beta_bytes.iter().map(|b| b.as_ref())) .chain(std::iter::once(commitment_kappa.to_bytes().as_ref()))