|
barretenberg
|
class that stores precomputed generators used for Pedersen commitments and Pedersen hashes More...
#include <generator_data.hpp>
Public Member Functions | |
| GeneratorView | get (const size_t num_generators, const size_t generator_offset=0, const std::string_view domain_separator=DEFAULT_DOMAIN_SEPARATOR) const |
Static Public Member Functions | |
| static constexpr std::array< AffineElement, DEFAULT_NUM_GENERATORS > | make_precomputed_generators () |
| static generator_data * | get_default_generators () |
Static Public Attributes | |
| static constexpr size_t | DEFAULT_NUM_GENERATORS = 8 |
| static constexpr std::string_view | DEFAULT_DOMAIN_SEPARATOR = "DEFAULT_DOMAIN_SEPARATOR" |
| static constexpr std::array< AffineElement, DEFAULT_NUM_GENERATORS > | precomputed_generators |
| Precompute a small number of generators at compile time. For small pedersen commitments + pedersen hashes, this prevents us from having to derive generators at runtime. | |
class that stores precomputed generators used for Pedersen commitments and Pedersen hashes
We create distinct sets of generators via the use of a domain separator. This enables the use of context-specific commitments and hashes. For example, a circuit that generates commitments foo = commit({ a, b }) and bar = commit({c, d}) where foo and bar should not collide.
The goal of generator_data is twofold:
g1::derive_generators methodWe store generators in a key:value map, where the key is the domain separator and the value is the vector of associated generators. Pedersen methods take in a pointer to a generator_data object.
generator_data contains a static instantiation of the class: default_data. The intention is for default_data to be used as a singleton class. All Pedersen methods that require a *generator_data parameter (from now on referred to as "generator
context") should default to using default_data.
Q: Why make the generator context an input parameter when it defaults to default_data? A: This is not thread-safe. Each process that uses a generator_data object may extend generator_data if more generators are required. i.e. either each process must use an independent generator_data object or the author must KNOW that generator_data will not be extended by any process
| Curve |
|
inlinestaticconstexpr |
Precompute a small number of generators at compile time. For small pedersen commitments + pedersen hashes, this prevents us from having to derive generators at runtime.