Skip to content

Instantly share code, notes, and snippets.

@Michael-Qedit
Created November 13, 2021 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Michael-Qedit/3babee7e3fd5073a25c27c8edc44203b to your computer and use it in GitHub Desktop.
Save Michael-Qedit/3babee7e3fd5073a25c27c8edc44203b to your computer and use it in GitHub Desktop.
Solution to ZHack puzzle 3
#![allow(unused, unreachable_code)]
use ark_ed_on_bls12_381::Fr;
use ark_ff::Field;
use double_trouble::data::puzzle_data;
use double_trouble::inner_product_argument::utils::challenge;
use double_trouble::verify;
use double_trouble::PUZZLE_DESCRIPTION;
use prompt::{puzzle, welcome};
use std::fmt::Display;
use std::str::FromStr;
fn main() {
welcome();
puzzle(PUZZLE_DESCRIPTION);
let (ck, [instance_and_proof_1, instance_and_proof_2]) = puzzle_data();
let (instance1, proof1) = instance_and_proof_1;
let (instance2, proof2) = instance_and_proof_2;
assert_eq!(instance1, instance2);
assert!(verify(&ck, &instance1, &proof1));
assert!(verify(&ck, &instance2, &proof2));
let (a, comm_a_rand): (Vec<Fr>, Fr) = {
// Your solution here!
(vec![Fr::from_str("2336706075964247989947433674548942226827306841875429968112509828215618329159").unwrap(),
Fr::from_str("3183796673245796636687562422863836804215466330278309281736435087784983849340").unwrap(),
Fr::from_str("5178612562806274700109127208151001095511383281260239557723446192273548168238").unwrap(),
Fr::from_str("2176409113060157430684277991899328451416352041675746388298954703991743482874").unwrap(),
Fr::from_str("5310968795039368315853267802615936582862130677392677794847104969389960514693").unwrap(),
Fr::from_str("5806564767929688700136171453700501428844225212575251330189050251826120035765").unwrap(),
Fr::from_str("1006011101679865533947259717866832372946407201677415593630279116718161273337").unwrap(),
Fr::from_str("1648764725587973804015859780978773015249711523441957090043447269437062523478").unwrap()],
Fr::from_str("1617264654250654530393647253572292035968664667634001469351271665735252350260").unwrap()
)
};
assert_eq!(
ck.commit_with_explicit_randomness(&a, comm_a_rand),
instance1.comm_a
);
assert_eq!(
ck.commit_with_explicit_randomness(&a, comm_a_rand),
instance2.comm_a
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment