diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-21 14:48:23 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-21 14:48:23 +0800 |
commit | a90c968b55d975bc0e958631892d1a1799ae97d5 (patch) | |
tree | 8111d4ee935f4a53bcb952811cda632fd151686f /sample/bls_smpl.cpp | |
parent | 3b17399925767333832756ca5ccc04c3197eed4b (diff) | |
download | dexon-bls-a90c968b55d975bc0e958631892d1a1799ae97d5.tar.gz dexon-bls-a90c968b55d975bc0e958631892d1a1799ae97d5.tar.zst dexon-bls-a90c968b55d975bc0e958631892d1a1799ae97d5.zip |
replace prv with sec
Diffstat (limited to 'sample/bls_smpl.cpp')
-rw-r--r-- | sample/bls_smpl.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sample/bls_smpl.cpp b/sample/bls_smpl.cpp index 36bb9e3..bbb558c 100644 --- a/sample/bls_smpl.cpp +++ b/sample/bls_smpl.cpp @@ -6,7 +6,7 @@ typedef std::vector<int> IntVec; const std::string pubFile = "sample/publickey"; -const std::string prvFile = "sample/privatekey"; +const std::string secFile = "sample/privatekey"; const std::string signFile = "sample/sign"; std::string makeName(const std::string& name, int id) @@ -38,12 +38,12 @@ void load(T& t, const std::string& file, int id = 0) int init() { - printf("make %s and %s files\n", prvFile.c_str(), pubFile.c_str()); - bls::SecretKey prv; - prv.init(); - save(prvFile, prv); + printf("make %s and %s files\n", secFile.c_str(), pubFile.c_str()); + bls::SecretKey sec; + sec.init(); + save(secFile, sec); bls::PublicKey pub; - prv.getPublicKey(pub); + sec.getPublicKey(pub); save(pubFile, pub); return 0; } @@ -51,10 +51,10 @@ int init() int sign(const std::string& m, int id) { printf("sign message `%s` by id=%d\n", m.c_str(), id); - bls::SecretKey prv; - load(prv, prvFile, id); + bls::SecretKey sec; + load(sec, secFile, id); bls::Sign s; - prv.sign(s, m); + sec.sign(s, m); save(signFile, s, id); return 0; } @@ -78,19 +78,19 @@ int verify(const std::string& m, int id) int share(int n, int k) { printf("%d-out-of-%d threshold sharing\n", k, n); - bls::SecretKey prv; - load(prv, prvFile); + bls::SecretKey sec; + load(sec, secFile); bls::SecretKeyVec msk; - prv.getMasterSecretKey(msk, k); - std::vector<bls::SecretKey> prvVec(n); + sec.getMasterSecretKey(msk, k); + std::vector<bls::SecretKey> secVec(n); for (int i = 0; i < n; i++) { - prvVec[i].set(msk, i + 1); + secVec[i].set(msk, i + 1); } for (int i = 0; i < n; i++) { - int id = prvVec[i].getId(); - save(prvFile, prvVec[i], id); + int id = secVec[i].getId(); + save(secFile, secVec[i], id); bls::PublicKey pub; - prvVec[i].getPublicKey(pub); + secVec[i].getPublicKey(pub); save(pubFile, pub, id); } return 0; |