Barretenberg
The ZK-SNARK library at the core of Aztec
|
Functions | |
template<uint64_t bits_per_slice, uint64_t num_rotated_output_bits, bool filter = false> | |
std::array< bb::fr, 2 > | get_xor_rotate_values_from_key (const std::array< uint64_t, 2 > key) |
template<uint64_t bits_per_slice, uint64_t num_rotated_output_bits, bool filter = false> | |
BasicTable | generate_xor_rotate_table (BasicTableId id, const size_t table_index) |
MultiTable | get_blake2s_xor_table (const MultiTableId id=BLAKE_XOR) |
MultiTable | get_blake2s_xor_rotate_16_table (const MultiTableId id=BLAKE_XOR_ROTATE_16) |
MultiTable | get_blake2s_xor_rotate_8_table (const MultiTableId id=BLAKE_XOR_ROTATE_8) |
MultiTable | get_blake2s_xor_rotate_7_table (const MultiTableId id=BLAKE_XOR_ROTATE_7) |
|
inline |
Generates a basic 32-bit (XOR + ROTR) lookup table.
Definition at line 38 of file blake2s.hpp.
|
inline |
Generates a multi-lookup-table with 5 slices for 32-bit operation ROTR^{16}(a ^ b).
Definition at line 117 of file blake2s.hpp.
|
inline |
Generates a multi-lookup-table with 5 slices for 32-bit operation ROTR^{7}(a ^ b).
Definition at line 187 of file blake2s.hpp.
|
inline |
Generates a multi-lookup-table with 5 slices for 32-bit operation ROTR^{8}(a ^ b).
Definition at line 152 of file blake2s.hpp.
|
inline |
Generates a multi-lookup-table with 5 slices for 32-bit XOR operation (a ^ b).
Details:
The following table summarizes the shifts required for each slice for different operations. We need to ensure that the coefficient of s0 always is 1, so we need adjust other coefficients accordingly. For example, the coefficient of slice s4 for ROTR_16 should be set to (2^8 / 2^{16}) = 2^{-8}.
Slice | ROTR_16 | ROTR_12 | ROTR_8 | ROTR_7 |
---|---|---|---|---|
s0 | 16 | 20 | 24 | 25 |
s1 | 22 | 26 | 0 | 0 |
s2 | 0 | 0 | 4 | 5 |
s3 | 2 | 6 | 10 | 11 |
s4 | 8 | 12 | 16 | 17 |
s5 | 14 | 18 | 22 | 23 |
We don't need to have a separate table for ROTR_12 as its output can be derived from an XOR table. Thus, we have a blake2s_xor_table function below.
Definition at line 94 of file blake2s.hpp.
|
inline |
This functions performs the operation ROTR^{k}(a ^ b) when filter is false and ROTR^{k}((a % 4) ^ (a % 4)) when filter is true. In other words, (filter = true) implies that the XOR operation works only on the two least significant bits.
Definition at line 25 of file blake2s.hpp.