16static constexpr size_t BITS_IN_LAST_SLICE = 5UL;
17static constexpr size_t SIZE_OF_LAST_SLICE = (1UL << BITS_IN_LAST_SLICE);
24template <u
int64_t bits_per_slice, u
int64_t num_rotated_output_bits,
bool filter = false>
27 uint64_t filtered_key0 = filter ?
key[0] & 3ULL :
key[0];
28 uint64_t filtered_key1 = filter ?
key[1] & 3ULL :
key[1];
30 uint32_t(num_rotated_output_bits))),
37template <u
int64_t bits_per_slice, u
int64_t num_rotated_output_bits,
bool filter = false>
40 const uint64_t base = 1UL << bits_per_slice;
46 for (uint64_t i = 0; i < base; ++i) {
47 for (uint64_t j = 0; j < base; ++j) {
61 table.
get_values_from_key = &get_xor_rotate_values_from_key<bits_per_slice, num_rotated_output_bits, filter>;
96 const size_t num_entries = (32 + 2) / 6 + 1;
97 const uint64_t base = 1 << 6;
98 MultiTable table(base, base, base, num_entries);
101 for (
size_t i = 0; i < num_entries - 1; ++i) {
107 table.
slice_sizes.emplace_back(SIZE_OF_LAST_SLICE);
109 table.
get_table_values.emplace_back(&get_xor_rotate_values_from_key<BITS_IN_LAST_SLICE, 0, true>);
119 const uint64_t base = 1 << 6;
128 coefficient_16 *
bb::fr(1 << 2),
129 coefficient_16 *
bb::fr(1 << 8),
130 coefficient_16 *
bb::fr(1 << 14) };
132 MultiTable table(column_1_coefficients, column_1_coefficients, column_3_coefficients);
135 table.
slice_sizes = { base, base, base, base, base, SIZE_OF_LAST_SLICE };
144 table.
get_table_values.emplace_back(&get_xor_rotate_values_from_key<BITS_IN_LAST_SLICE, 0, true>);
154 const uint64_t base = 1 << 6;
162 coefficient_24 *
bb::fr(1 << 4),
163 coefficient_24 *
bb::fr(1 << (4 + 6)),
164 coefficient_24 *
bb::fr(1 << (4 + 12)),
165 coefficient_24 *
bb::fr(1 << (4 + 18)) };
167 MultiTable table(column_1_coefficients, column_1_coefficients, column_3_coefficients);
170 table.
slice_sizes = { base, base, base, base, base, SIZE_OF_LAST_SLICE };
179 table.
get_table_values.emplace_back(&get_xor_rotate_values_from_key<BITS_IN_LAST_SLICE, 0, true>);
189 const uint64_t base = 1 << 6;
197 coefficient_25 *
bb::fr(1 << 5),
198 coefficient_25 *
bb::fr(1 << (5 + 6)),
199 coefficient_25 *
bb::fr(1 << (5 + 12)),
200 coefficient_25 *
bb::fr(1 << (5 + 18)) };
202 MultiTable table(column_1_coefficients, column_1_coefficients, column_3_coefficients);
205 table.
slice_sizes = { base, base, base, base, base, SIZE_OF_LAST_SLICE };
214 table.
get_table_values.emplace_back(&get_xor_rotate_values_from_key<BITS_IN_LAST_SLICE, 0, true>);
constexpr uint32_t rotate32(const uint32_t value, const uint32_t rotation)
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)
BasicTable generate_xor_rotate_table(BasicTableId id, const size_t table_index)
MultiTable get_blake2s_xor_rotate_16_table(const MultiTableId id=BLAKE_XOR_ROTATE_16)
std::array< bb::fr, 2 > get_xor_rotate_values_from_key(const std::array< uint64_t, 2 > key)
MultiTable get_blake2s_xor_table(const MultiTableId id=BLAKE_XOR)
@ BLAKE_XOR_ROTATE0_SLICE5_MOD4
field< Bn254FrParams > fr
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
A basic table from which we can perform lookups (for example, an xor table)
bb::fr column_2_step_size
bb::fr column_1_step_size
std::vector< bb::fr > column_3
std::vector< bb::fr > column_2
std::array< bb::fr, 2 >(* get_values_from_key)(const std::array< uint64_t, 2 >)
std::vector< bb::fr > column_1
bb::fr column_3_step_size
Container for managing multiple BasicTables plus the data needed to combine basic table outputs (e....
std::vector< BasicTableId > basic_table_ids
std::vector< uint64_t > slice_sizes
std::vector< table_out(*)(table_in)> get_table_values