mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
bulletproofs: add aggregated verification
Ported from sarang's java code
This commit is contained in:
parent
e895c3def1
commit
bacf0a1e2f
11 changed files with 453 additions and 259 deletions
|
@ -60,3 +60,41 @@ public:
|
|||
private:
|
||||
rct::Bulletproof proof;
|
||||
};
|
||||
|
||||
template<bool batch, size_t start, size_t repeat, size_t mul, size_t add, size_t N>
|
||||
class test_aggregated_bulletproof
|
||||
{
|
||||
public:
|
||||
static const size_t loop_count = 500 / (N * repeat);
|
||||
|
||||
bool init()
|
||||
{
|
||||
size_t o = start;
|
||||
for (size_t n = 0; n < N; ++n)
|
||||
{
|
||||
//printf("adding %zu times %zu\n", repeat, o);
|
||||
for (size_t i = 0; i < repeat; ++i)
|
||||
proofs.push_back(rct::bulletproof_PROVE(std::vector<uint64_t>(o, 749327532984), rct::skvGen(o)));
|
||||
o = o * mul + add;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool test()
|
||||
{
|
||||
if (batch)
|
||||
{
|
||||
return rct::bulletproof_VERIFY(proofs);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const rct::Bulletproof &proof: proofs)
|
||||
if (!rct::bulletproof_VERIFY(proof))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<rct::Bulletproof> proofs;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue