Browse Source

ready for PR

pull/8/head
Nanak Nihal Khalsa 1 year ago
parent
commit
f68d8fbddd
2 changed files with 1 additions and 6 deletions
  1. +1
    -2
      Cargo.toml
  2. +0
    -4
      src/lib.rs

+ 1
- 2
Cargo.toml

@ -14,9 +14,8 @@ rand_new = {package="rand", version="0.8.5"}
rand = "0.4.6" rand = "0.4.6"
# rand = "0.8" # rand = "0.8"
num = "0.4" num = "0.4"
num-bigint = {version = "0.4", features = ["rand"]}
num-bigint = {version = "0.4", features = ["rand", "serde"]}
num-traits = "0.2.8" num-traits = "0.2.8"
# blake2 = "0.10.6"
blake-hash = {version="0.4.0", optional=true} blake-hash = {version="0.4.0", optional=true}
blake = {version="2.0.1", optional=true} blake = {version="2.0.1", optional=true}
generic-array = "0.14" generic-array = "0.14"

+ 0
- 4
src/lib.rs

@ -205,7 +205,6 @@ pub trait FrBigIntConversion {
impl FrBigIntConversion<Fr> for Fr { impl FrBigIntConversion<Fr> for Fr {
// Note: this could probably be more efficient by converting bigint to raw repr to Fr // Note: this could probably be more efficient by converting bigint to raw repr to Fr
fn from_bigint(bi: &BigInt) -> Fr { fn from_bigint(bi: &BigInt) -> Fr {
println!("bi: {}", bi.to_string());
Fr::from_str(&bi.to_string()).unwrap() Fr::from_str(&bi.to_string()).unwrap()
} }
fn to_bigint(&self) -> BigInt { fn to_bigint(&self) -> BigInt {
@ -705,7 +704,6 @@ impl DLEQProof {
// TODO: better error handling (not assert), make it more efficient too: // TODO: better error handling (not assert), make it more efficient too:
assert!(x_bigint < modulus); assert!(x_bigint < modulus);
// println!("modulus overflow? isn't it bigger than Fr's order: {:?}", modulus_overflowed);
let k_bigint = rand_new::thread_rng().gen_biguint(512).to_bigint().unwrap() % &modulus; let k_bigint = rand_new::thread_rng().gen_biguint(512).to_bigint().unwrap() % &modulus;
let k = Fl::from_bigint(&k_bigint); let k = Fl::from_bigint(&k_bigint);
@ -744,7 +742,6 @@ impl DLEQProof {
); );
let challenge = DLEQProof::get_challenge(&self.A, &self.B, &self.xA, &self.xB, &kA_, &kB_); let challenge = DLEQProof::get_challenge(&self.A, &self.B, &self.xA, &self.xB, &kA_, &kB_);
println!("got challenge: {:?} which should equal {:?}", challenge, self.challenge);
return challenge == self.challenge; return challenge == self.challenge;
@ -789,7 +786,6 @@ mod tests {
let mut rng = rand_new::thread_rng(); let mut rng = rand_new::thread_rng();
let x = Fl::from_bigint(&rng.gen_biguint(512).to_bigint().unwrap()); let x = Fl::from_bigint(&rng.gen_biguint(512).to_bigint().unwrap());
let proof = DLEQProof::new(x, point_A, point_B).unwrap(); let proof = DLEQProof::new(x, point_A, point_B).unwrap();
println!("proof: {:?}", proof.verify());
assert!(proof.verify()); assert!(proof.verify());
} }
#[test] #[test]

Loading…
Cancel
Save