Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark G1 and G2 subgroup validation #197

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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