scipr-lab / libsnark

C++ library for zkSNARKs
Other
1.8k stars 570 forks source link

How to set up pb.primary_input() on the verifier side #188

Open wzjin2017 opened 2 years ago

wzjin2017 commented 2 years ago

Hi, I am building a two-to-one hash function using this post. I generated proof and keypair.vk, and serialized them. However, on the verifier side, when I try to use bool verified = r1cs_ppzksnark_verifier_strong_IC<default_r1cs_ppzksnark_pp>(keypair.vk, pb.primary_input(), proof);, I don't know how to set up this pb.primary_input(). I know this should be the y in y = Hash(x1, x2). Do I need to set up a new pb and input this y value using something like const libff::bit_vector y = libff::int_list_to_bits({0xe421ca1e, 0x71d16149, 0x8997ecc3, 0x6d05272a, 0xecc74cc9, 0xf5d071a5, 0x7e743987, 0x1bae758c}, 32); ?

Thanks in advance!