-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new protocol for zk discrete log with El-Gamal commitment #4
base: m
Are you sure you want to change the base?
Conversation
//! | ||
//! //! ## Description | ||
//! | ||
//! A party P has `L = g * lambda`, `M = (g * y) (X * lambda)`, and `Y = h * y`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! A party P has `L = g * lambda`, `M = (g * y) (X * lambda)`, and `Y = h * y`, | |
//! A party P has `L = g ^ lambda`, `M = (g ^ y) * (X ^ lambda)`, and `Y = h ^ y`, |
//! with g being a generator of curve `E`, h is a point of the curve | ||
//! and X is a public key (and a point of the curve). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! with g being a generator of curve `E`, h is a point of the curve | |
//! and X is a public key (and a point of the curve). | |
//! with g being a generator of curve `E`, h is a point on the curve | |
//! and X is a public key (and a point on the curve). |
//! | ||
//! Given: | ||
//! - Curve `E` | ||
//! - `X` - public key, point of the curve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! - `X` - public key, point of the curve | |
//! - `X` - public key, point on the curve |
//! Given: | ||
//! - Curve `E` | ||
//! - `X` - public key, point of the curve | ||
//! - `L = g * lambda`, `M = (g * y) (X * lambda)`, and `Y = h * y` - data to obtain proof about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! - `L = g * lambda`, `M = (g * y) (X * lambda)`, and `Y = h * y` - data to obtain proof about | |
//! - `L = g * lambda`, `M = (g ^ y) * (X ^ lambda)`, and `Y = h ^ y` - data to obtain proof about |
//! - `L = g * lambda`, `M = (g * y) (X * lambda)`, and `Y = h * y` - data to obtain proof about | ||
//! | ||
//! Prove: | ||
//! - `logarithm base h of Y= lambda` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! - `logarithm base h of Y= lambda` | |
//! - `logarithm base h of Y= y` |
Right?
//! | ||
//! // 1. Setup: prover prepares the public key X | ||
//! | ||
//! // X in paper is a point of the Curve E |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! // X in paper is a point of the Curve E | |
//! // X in paper is a point on the Curve E |
//! // X in paper is a point of the Curve E | ||
//! let x = Point::<E>::generator() * Scalar::random(&mut rng); | ||
//! | ||
//! // h in paper is a point of the Curve E |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! // h in paper is a point of the Curve E | |
//! // h in paper is a point on the Curve E |
//! // y in paper | ||
//! let y = Integer::from_rng_pm(&security.q,&mut rng); | ||
//! // lambda in paper | ||
//! let lambda = Integer::from_rng_pm(&security.q,&mut rng); | ||
//! | ||
//! // 3. Setup: prover encrypts everything on correct keys | ||
//! | ||
//! // L in paper | ||
//! let l = Point::<C>::generator() * lambda.to_scalar(); | ||
//! // M in paper | ||
//! let m = Point::<C>::generator() * y.to_scalar() + x * lambda.to_scalar(); | ||
//! // Y in paper | ||
//! let h_to_y = h * y.to_scalar(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! // y in paper | |
//! let y = Integer::from_rng_pm(&security.q,&mut rng); | |
//! // lambda in paper | |
//! let lambda = Integer::from_rng_pm(&security.q,&mut rng); | |
//! | |
//! // 3. Setup: prover encrypts everything on correct keys | |
//! | |
//! // L in paper | |
//! let l = Point::<C>::generator() * lambda.to_scalar(); | |
//! // M in paper | |
//! let m = Point::<C>::generator() * y.to_scalar() + x * lambda.to_scalar(); | |
//! // Y in paper | |
//! let h_to_y = h * y.to_scalar(); | |
//! // y in paper | |
//! let plaintext_y = Integer::from_rng_pm(&security.q,&mut rng); | |
//! // lambda in paper | |
//! let plaintext_lambda = Integer::from_rng_pm(&security.q,&mut rng); | |
//! | |
//! // 3. Setup: prover encrypts everything on correct keys | |
//! | |
//! // L in paper | |
//! let ciphertext_l = Point::<C>::generator() * plaintext_lambda.to_scalar(); | |
//! // M in paper | |
//! let ciphertext_m = Point::<C>::generator() * plaintext_y.to_scalar() + x * plaintext_lambda.to_scalar(); | |
//! // Y in paper | |
//! let ciphertext_h_to_y = h * plaintext_y.to_scalar(); |
//! // and lambda are the same | ||
//! | ||
//! let data = p::Data { | ||
//! key0: &key0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! key0: &key0, |
I don't believe we are using a key0
.
//! l: &l, | ||
//! m: &m, | ||
//! x: &x, | ||
//! h_to_y: &h_to_y, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! l: &l, | |
//! m: &m, | |
//! x: &x, | |
//! h_to_y: &h_to_y, | |
//! l: &ciphertext_l, | |
//! m: &ciphertext_m, | |
//! x: &x, | |
//! h_to_y: &ciphertext_h_to_y, |
//! y: &y, | ||
//! lambda: &lambda, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! y: &y, | |
//! lambda: &lambda, | |
//! y: &plaintext_y, | |
//! lambda: &plaintext_lambda, |
pub lambda: &'a Integer, | ||
} | ||
|
||
// As described in cggmp21 at page 35 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// As described in cggmp21 at page 35 | |
// As described in cggmp24 at page 57 |
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(bound = ""))] | ||
pub struct Commitment<C: Curve> { | ||
pub a: Point<C>, | ||
pub cap_n: Point<C>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cap_n
stands for capital n? Why are the others (a, b) not following the same naming?
let alpha = Integer::gen_invertible(&Integer::curve_order::<C>(), &mut rng); | ||
let m = Integer::gen_invertible(&Integer::curve_order::<C>(), &mut rng); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
let a= Point::<C>::generator() * alpha.to_scalar(); | ||
let enne= Point::<C>::generator() * m.to_scalar() + data.x * alpha.to_scalar(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not cap_n
?
challenge: &Challenge, | ||
proof: &Proof, | ||
) -> Result<(), InvalidProof> { | ||
// Three equality checks and two range checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Three equality checks and two range checks | |
// Three equality checks |
let security = super::SecurityParams { | ||
q: (Integer::ONE << 128_u32).into(), | ||
}; | ||
let y = Integer::from_rng_pm(&security.q,&mut rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let y = Integer::from_rng_pm(&security.q,&mut rng); | |
let y = Integer::from_rng_pm(&security.q,&mut rng); |
let security = super::SecurityParams { | ||
q: (Integer::ONE << 128_u32).into(), | ||
}; | ||
let y = Integer::from_rng_pm(&security.q,&mut rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let y = Integer::from_rng_pm(&security.q,&mut rng); | |
let y = Integer::from_rng_pm(&security.q, &mut rng); |
let lambda = Integer::from_rng_pm(&security.q,&mut rng); | ||
let false_lambda = Integer::from_rng_pm(&security.q,&mut rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let lambda = Integer::from_rng_pm(&security.q,&mut rng); | |
let false_lambda = Integer::from_rng_pm(&security.q,&mut rng); | |
let lambda = Integer::from_rng_pm(&security.q, &mut rng); | |
let false_lambda = Integer::from_rng_pm(&security.q, &mut rng); |
let y = Integer::from_rng_pm(&security.q,&mut rng); | ||
let lambda = Integer::from_rng_pm(&security.q,&mut rng); | ||
let false_y = Integer::from_rng_pm(&security.q,&mut rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let y = Integer::from_rng_pm(&security.q,&mut rng); | |
let lambda = Integer::from_rng_pm(&security.q,&mut rng); | |
let false_y = Integer::from_rng_pm(&security.q,&mut rng); | |
let y = Integer::from_rng_pm(&security.q, &mut rng); | |
let lambda = Integer::from_rng_pm(&security.q, &mut rng); | |
let false_y = Integer::from_rng_pm(&security.q, &mut rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run cargo fmt
?
It seems good to go!
No description provided.