-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libzecale: use null hash in most cases (avoid huge testing times unti…
…l we have an optimized hash)
- Loading branch information
Showing
6 changed files
with
102 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2015-2020 Clearmatics Technologies Ltd | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0+ | ||
|
||
#ifndef __ZECALE_CIRCUIT_NULL_HASH_GADGET_HPP__ | ||
#define __ZECALE_CIRCUIT_NULL_HASH_GADGET_HPP__ | ||
|
||
namespace libzecale | ||
{ | ||
|
||
/// A trivial hash gadget as a way to disable verification key hashing in | ||
/// the aggregator_circuit_wrapper. | ||
template<typename FieldT> class null_hash_gadget | ||
{ | ||
public: | ||
null_hash_gadget( | ||
libsnark::protoboard<FieldT> &pb, | ||
const libsnark::block_variable<FieldT> &input, | ||
const libsnark::digest_variable<FieldT> &output, | ||
const std::string &annotation_prefix); | ||
|
||
void generate_r1cs_constraints(const bool ensure_output_bitness = true); | ||
void generate_r1cs_witness(); | ||
|
||
static size_t get_digest_len(); | ||
}; | ||
|
||
} // namespace libzecale | ||
|
||
#include "libzecale/circuits/null_hash_gadget.tcc" | ||
|
||
#endif // __ZECALE_CIRCUIT_NULL_HASH_GADGET_HPP__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2015-2020 Clearmatics Technologies Ltd | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0+ | ||
|
||
#ifndef __ZECALE_CIRCUIT_NULL_GADGET_HPP__ | ||
#define __ZECALE_CIRCUIT_NULL_GADGET_HPP__ | ||
|
||
namespace libzecale | ||
{ | ||
|
||
template<typename FieldT> | ||
null_hash_gadget<FieldT>::null_hash_gadget( | ||
libsnark::protoboard<FieldT> & /* pb */, | ||
const libsnark::block_variable<FieldT> & /* input */, | ||
const libsnark::digest_variable<FieldT> & /* output */, | ||
const std::string & /* annotation_prefix */) | ||
{ | ||
} | ||
|
||
template<typename FieldT> | ||
void null_hash_gadget<FieldT>::generate_r1cs_constraints( | ||
const bool /* ensure_output_bitness */) | ||
{ | ||
} | ||
|
||
template<typename FieldT> void null_hash_gadget<FieldT>::generate_r1cs_witness() | ||
{ | ||
} | ||
|
||
template<typename FieldT> size_t null_hash_gadget<FieldT>::get_digest_len() | ||
{ | ||
return 0; | ||
} | ||
|
||
} // namespace libzecale | ||
|
||
#endif // __ZECALE_CIRCUIT_NULL_GADGET_HPP__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters