aboutsummaryrefslogtreecommitdiffstats
path: root/src/bls.cpp
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-08-27 17:03:04 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-08-27 17:03:04 +0800
commitea600930c3e920b75d15fa1bffe3d48d818a294b (patch)
tree50f9845ac43a8e79422cc253416e28f78c56ce38 /src/bls.cpp
parentfec0cc33f5074e76764f87eaf6b26c7ed8bca5a4 (diff)
downloaddexon-bls-ea600930c3e920b75d15fa1bffe3d48d818a294b.tar
dexon-bls-ea600930c3e920b75d15fa1bffe3d48d818a294b.tar.gz
dexon-bls-ea600930c3e920b75d15fa1bffe3d48d818a294b.tar.bz2
dexon-bls-ea600930c3e920b75d15fa1bffe3d48d818a294b.tar.lz
dexon-bls-ea600930c3e920b75d15fa1bffe3d48d818a294b.tar.xz
dexon-bls-ea600930c3e920b75d15fa1bffe3d48d818a294b.tar.zst
dexon-bls-ea600930c3e920b75d15fa1bffe3d48d818a294b.zip
init by user defined p
Diffstat (limited to 'src/bls.cpp')
-rw-r--r--src/bls.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bls.cpp b/src/bls.cpp
index ab3d68b..40599af 100644
--- a/src/bls.cpp
+++ b/src/bls.cpp
@@ -180,9 +180,13 @@ inline bool Sign::verify(const PublicKey& pub, const std::string& m) const
struct SecretKey {
Fr s;
const Fr& get() const { return s; }
- void init()
+ void init(const uint64_t *p)
{
- s.setRand(getRG());
+ if (p) {
+ s.setArray(p, keySize);
+ } else {
+ s.setRand(getRG());
+ }
}
void getPublicKey(PublicKey& pub) const
{
@@ -367,9 +371,9 @@ std::istream& operator>>(std::istream& is, SecretKey& sec)
return is >> sec.id_ >> sec.self_->s;
}
-void SecretKey::init()
+void SecretKey::init(const uint64_t *p)
{
- self_->init();
+ self_->init(p);
}
void SecretKey::getPublicKey(PublicKey& pub) const