提交 53066018 编辑于 作者: Heng Wang's avatar Heng Wang
浏览文件

Test Modify

上级 90a6c72a
......@@ -71,9 +71,7 @@ BasicSAS::aggregateVerify(unsigned t, const vector<PK>& pks, const vector<string
if (pks[i] == pks[j]) return false;
}
}
cout << "Final Steps." << endl;
Integer e_t{this->publicParameters.hashToPrime(t)};
cout << "e_t " << e_t << endl;
Integer left{ma.Exponentiate(aggSignatures, e_t)};
Integer right{Integer::One()};
for (int i = 0; i < pks.size(); ++i) {
......@@ -83,8 +81,6 @@ BasicSAS::aggregateVerify(unsigned t, const vector<PK>& pks, const vector<string
right = ma.Multiply(right, ma.Exponentiate(pks[i][j], msg_frags[j-1]));
}
}
cout << "Left: " << left << endl;
cout << "Right: " << right << endl;
return left == right;
}
......@@ -114,28 +110,27 @@ BasicSAS::dismantleMsg(const string& msg)
int
main(int argc, char** argv)
{
const unsigned lambda = 256;
const unsigned timePeriod = 10;
const unsigned lambda = 128;
const unsigned timePeriod = 1000;
Setup pp{lambda, timePeriod};
BasicSAS sasOne{pp}, sasTwo{pp}, sasThree{pp};
cout << "Setup Done." << endl;
sasOne.Keygen();
sasTwo.Keygen();
sasThree.Keygen();
string msgOne{"Hello, World."};
string msgTwo{"C++"};
string msgThree{"Python"};
string msgFake{"Hello."};
const unsigned time = 2;
const unsigned timeFake = 3;
Integer sOne{sasOne.sign(msgOne, time)}, sTwo{sasTwo.sign(msgTwo, time)}, sThree{sasThree.sign(msgThree, time)};
Integer aggS{sasOne.aggregate(time, {sOne, sTwo, sThree})};
cout << sasOne.verify(msgOne, time, sOne) << endl;
cout << sasTwo.verify(msgTwo, time, sTwo) << endl;
cout << sasThree.verify(msgThree, time, sThree) << endl;
cout << aggS << endl;
cout << sasTwo.aggregateVerify(time, {sasOne.publicKey(), sasTwo.publicKey(), sasThree.publicKey()}, {msgOne, msgTwo, msgThree}, aggS) << endl;
vector<BasicSAS*> signers;
unsigned time = 10;
for (int i = 0; i < 100; ++i) {
BasicSAS *s = new BasicSAS{pp};
signers.push_back(s);
}
for (int i = 0; i < 100; ++i) {
signers[i]->Keygen();
}
vector<string> msgs;
vector<Integer> signatures;
vector<PK> pks;
for (int i = 0; i < 100; ++i) {
msgs.push_back(std::to_string(i));
signatures.push_back(signers[i]->sign(msgs[i], time));
pks.push_back(signers[i]->publicKey());
}
Integer aggS{signers.front()->aggregate(time, signatures)};
cout << signers.front()->aggregateVerify(time, pks, msgs, aggS) << endl;
}
\ No newline at end of file
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册