From 032164d5d5006820da06f29d6525115054b2c2c6 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Wed, 11 May 2016 13:06:47 -0600 Subject: [PATCH] Rename hmac -> mac in circuit. --- src/zcash/JoinSplit.cpp | 4 ++-- src/zcash/circuit/gadget.tcc | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/zcash/JoinSplit.cpp b/src/zcash/JoinSplit.cpp index 37b57fb96..9422e6215 100644 --- a/src/zcash/JoinSplit.cpp +++ b/src/zcash/JoinSplit.cpp @@ -128,7 +128,7 @@ public: const std::string& proof, const uint256& pubKeyHash, const uint256& randomSeed, - const boost::array& hmacs, + const boost::array& macs, const boost::array& nullifiers, const boost::array& commitments, uint64_t vpub_old, @@ -149,7 +149,7 @@ public: auto witness = joinsplit_gadget::witness_map( rt, h_sig, - hmacs, + macs, nullifiers, commitments, vpub_old, diff --git a/src/zcash/circuit/gadget.tcc b/src/zcash/circuit/gadget.tcc index abfa1cad4..a79ad75c6 100644 --- a/src/zcash/circuit/gadget.tcc +++ b/src/zcash/circuit/gadget.tcc @@ -15,7 +15,7 @@ private: std::shared_ptr> zk_merkle_root; std::shared_ptr> zk_h_sig; boost::array>, NumInputs> zk_input_nullifiers; - boost::array>, NumInputs> zk_input_hmacs; + boost::array>, NumInputs> zk_input_macs; boost::array>, NumOutputs> zk_output_commitments; pb_variable_array zk_vpub_old; pb_variable_array zk_vpub_new; @@ -27,7 +27,7 @@ private: // Input note gadgets boost::array>, NumInputs> zk_input_notes; - boost::array>, NumInputs> zk_hmac_authentication; + boost::array>, NumInputs> zk_mac_authentication; // Output note gadgets boost::array>, NumOutputs> zk_output_notes; @@ -57,7 +57,7 @@ public: for (size_t i = 0; i < NumInputs; i++) { alloc_uint256(zk_unpacked_inputs, zk_input_nullifiers[i]); - alloc_uint256(zk_unpacked_inputs, zk_input_hmacs[i]); + alloc_uint256(zk_unpacked_inputs, zk_input_macs[i]); } for (size_t i = 0; i < NumOutputs; i++) { @@ -93,7 +93,7 @@ public: zk_total_uint64.allocate(pb, 64); for (size_t i = 0; i < NumInputs; i++) { - // Input note gadget for commitments, hmacs, nullifiers, + // Input note gadget for commitments, macs, nullifiers, // and spend authority. zk_input_notes[i].reset(new input_note_gadget( pb, @@ -104,13 +104,13 @@ public: // The input keys authenticate h_sig to prevent // malleability. - zk_hmac_authentication[i].reset(new PRF_pk_gadget( + zk_mac_authentication[i].reset(new PRF_pk_gadget( pb, ZERO, zk_input_notes[i]->a_sk->bits, zk_h_sig->bits, i ? true : false, - zk_input_hmacs[i] + zk_input_macs[i] )); } @@ -142,7 +142,7 @@ public: zk_input_notes[i]->generate_r1cs_constraints(); // Authenticate h_sig with a_sk - zk_hmac_authentication[i]->generate_r1cs_constraints(); + zk_mac_authentication[i]->generate_r1cs_constraints(); } for (size_t i = 0; i < NumOutputs; i++) { @@ -252,8 +252,8 @@ public: inputs[i].note ); - // Witness hmacs - zk_hmac_authentication[i]->generate_r1cs_witness(); + // Witness macs + zk_mac_authentication[i]->generate_r1cs_witness(); } for (size_t i = 0; i < NumOutputs; i++) { @@ -280,7 +280,7 @@ public: static r1cs_primary_input witness_map( const uint256& rt, const uint256& h_sig, - const boost::array& hmacs, + const boost::array& macs, const boost::array& nullifiers, const boost::array& commitments, uint64_t vpub_old, @@ -293,7 +293,7 @@ public: for (size_t i = 0; i < NumInputs; i++) { insert_uint256(verify_inputs, nullifiers[i]); - insert_uint256(verify_inputs, hmacs[i]); + insert_uint256(verify_inputs, macs[i]); } for (size_t i = 0; i < NumOutputs; i++) { @@ -316,7 +316,7 @@ public: acc += 256; // h_sig for (size_t i = 0; i < NumInputs; i++) { acc += 256; // nullifier - acc += 256; // hmac + acc += 256; // mac } for (size_t i = 0; i < NumOutputs; i++) { acc += 256; // new commitment