forked from lthn/blockchain
crypto: BPP & BPPE: get_2_to_the_power_of_N_minus_1()
This commit is contained in:
parent
b0e8e6c2eb
commit
0fd6406158
3 changed files with 8 additions and 5 deletions
|
|
@ -573,8 +573,7 @@ namespace crypto
|
|||
for (size_t i = 0; i < interm.c_bpp_m; ++i)
|
||||
d(i, j) = d(i, j - 1) + d(i, j - 1);
|
||||
// sum(d) (see also note in proof function for this)
|
||||
static const scalar_t c_scalar_2_power_n_minus_1 = { 0xffffffffffffffff, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 };
|
||||
const scalar_t sum_d = c_scalar_2_power_n_minus_1 * sum_of_powers(interm.z_sq, interm.c_bpp_log2_m);
|
||||
const scalar_t sum_d = CT::get_2_to_the_power_of_N_minus_1() * sum_of_powers(interm.z_sq, interm.c_bpp_log2_m);
|
||||
|
||||
DBG_PRINT("Hs(d): " << d.calc_hs());
|
||||
DBG_PRINT("sum(d): " << sum_d);
|
||||
|
|
|
|||
|
|
@ -588,9 +588,7 @@ namespace crypto
|
|||
for (size_t i = 0; i < interm.c_bpp_m; ++i)
|
||||
d(i, j) = d(i, j - 1) + d(i, j - 1);
|
||||
// sum(d) (see also note in proof function for this)
|
||||
// TODO: check for not 2^64 version
|
||||
static const scalar_t c_scalar_2_power_n_minus_1 = { 0xffffffffffffffff, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 };
|
||||
const scalar_t sum_d = c_scalar_2_power_n_minus_1 * sum_of_powers(interm.z_sq, interm.c_bpp_log2_m);
|
||||
const scalar_t sum_d = CT::get_2_to_the_power_of_N_minus_1() * sum_of_powers(interm.z_sq, interm.c_bpp_log2_m);
|
||||
|
||||
DBG_PRINT("Hs(d): " << d.calc_hs());
|
||||
DBG_PRINT("sum(d): " << sum_d);
|
||||
|
|
|
|||
|
|
@ -110,6 +110,12 @@ namespace crypto
|
|||
return generators[2 * index + (select_H ? 1 : 0)];
|
||||
}
|
||||
|
||||
static const scalar_t& get_2_to_the_power_of_N_minus_1()
|
||||
{
|
||||
static scalar_t result = scalar_t::power_of_2(c_bpp_n) - 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
static const point_t& bpp_H;
|
||||
static const point_t& bpp_H2;
|
||||
}; // struct bpp_crypto_trait_zano
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue