Skip to content

Commit

Permalink
benchmark G1 and G2 subgroup validation
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Mar 31, 2021
1 parent 65a17a3 commit e420770
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/test-bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ void benchVerification() {
void benchBatchVerification() {
double numIters = 100000;

vector<G2Element> sigs;
vector<G1Element> pks;
vector<vector<uint8_t>> sig_bytes;
vector<vector<uint8_t>> pk_bytes;
vector<vector<uint8_t>> ms;

for (size_t i = 0; i < numIters; i++) {
Expand All @@ -81,12 +81,30 @@ void benchBatchVerification() {
vector<uint8_t> messageBytes(message, message + 4);
PrivateKey sk = AugSchemeMPL().KeyGen(getRandomSeed());
G1Element pk = sk.GetG1Element();
sigs.push_back(AugSchemeMPL().Sign(sk, messageBytes));
pks.push_back(pk);
sig_bytes.push_back(AugSchemeMPL().Sign(sk, messageBytes).Serialize());
pk_bytes.push_back(pk.Serialize());
ms.push_back(messageBytes);
}

vector<G1Element> pks;
pks.reserve(numIters);

auto start = startStopwatch();
for (auto const& pk : pk_bytes) {
pks.emplace_back(G1Element::FromBytes(Bytes(pk)));
}
endStopwatch("Public key validation", start, numIters);

vector<G2Element> sigs;
sigs.reserve(numIters);

start = startStopwatch();
for (auto const& sig : sig_bytes) {
sigs.emplace_back(G2Element::FromBytes(Bytes(sig)));
}
endStopwatch("Signature validation", start, numIters);

start = startStopwatch();
G2Element aggSig = AugSchemeMPL().Aggregate(sigs);
endStopwatch("Aggregation", start, numIters);

Expand Down

0 comments on commit e420770

Please sign in to comment.