zkSNARK: Enforce that new output notes have unique rho to prevent faerie gold attack.

This commit is contained in:
Sean Bowe
2016-05-04 18:25:59 -06:00
parent e52f40e839
commit 6b010d9bfd
3 changed files with 116 additions and 1 deletions

View File

@@ -116,3 +116,24 @@ public:
PRF_gadget<FieldT>::generate_r1cs_witness();
}
};
template<typename FieldT>
class PRF_rho_gadget : public PRF_gadget<FieldT> {
public:
PRF_rho_gadget(
protoboard<FieldT>& pb,
pb_variable<FieldT>& ZERO,
pb_variable_array<FieldT>& phi,
pb_variable_array<FieldT>& h_sig,
bool nonce,
std::shared_ptr<digest_variable<FieldT>> result
) : PRF_gadget<FieldT>(pb, ZERO, 0, nonce, 1, 0, phi, h_sig, result) {}
void generate_r1cs_constraints() {
PRF_gadget<FieldT>::generate_r1cs_constraints();
}
void generate_r1cs_witness() {
PRF_gadget<FieldT>::generate_r1cs_witness();
}
};