diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-31 09:59:53 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-31 09:59:53 +0800 |
commit | dc508d1ff0607285d8b4df8a71805be28ef5b8f5 (patch) | |
tree | 60f2efa81fc455e3feced9519e90c5592f022d4e /src | |
parent | 81e88d1c6d9fca8f92787cab308deceb2861b6c3 (diff) | |
download | dexon-bls-dc508d1ff0607285d8b4df8a71805be28ef5b8f5.tar dexon-bls-dc508d1ff0607285d8b4df8a71805be28ef5b8f5.tar.gz dexon-bls-dc508d1ff0607285d8b4df8a71805be28ef5b8f5.tar.bz2 dexon-bls-dc508d1ff0607285d8b4df8a71805be28ef5b8f5.tar.lz dexon-bls-dc508d1ff0607285d8b4df8a71805be28ef5b8f5.tar.xz dexon-bls-dc508d1ff0607285d8b4df8a71805be28ef5b8f5.tar.zst dexon-bls-dc508d1ff0607285d8b4df8a71805be28ef5b8f5.zip |
always hex string with prefix 0x
Diffstat (limited to 'src')
-rw-r--r-- | src/bls.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/bls.cpp b/src/bls.cpp index 096fe36..2fce4b3 100644 --- a/src/bls.cpp +++ b/src/bls.cpp @@ -174,6 +174,14 @@ void LagrangeInterpolation(G& r, const T& vec, const IdVec& S) } } +template<class T> +std::ostream& writeAsHex(std::ostream& os, const T& t) +{ + std::string str; + t.getStr(str, 16, true); + return os << str; +} + Id::Id(unsigned int id) : self_(new impl::Id()) { @@ -203,7 +211,7 @@ bool Id::operator==(const Id& rhs) const std::ostream& operator<<(std::ostream& os, const Id& id) { - return os << id.self_->v; + return writeAsHex(os, id.self_->v); } std::istream& operator>>(std::istream& is, Id& id) @@ -249,7 +257,7 @@ bool Sign::operator==(const Sign& rhs) const std::ostream& operator<<(std::ostream& os, const Sign& s) { - return os << s.self_->sHm; + return writeAsHex(os, s.self_->sHm); } std::istream& operator>>(std::istream& os, Sign& s) @@ -312,7 +320,7 @@ bool PublicKey::operator==(const PublicKey& rhs) const std::ostream& operator<<(std::ostream& os, const PublicKey& pub) { - return os << pub.self_->sQ; + return writeAsHex(os, pub.self_->sQ); } std::istream& operator>>(std::istream& is, PublicKey& pub) @@ -364,7 +372,7 @@ bool SecretKey::operator==(const SecretKey& rhs) const std::ostream& operator<<(std::ostream& os, const SecretKey& sec) { - return os << sec.self_->s; + return writeAsHex(os, sec.self_->s); } std::istream& operator>>(std::istream& is, SecretKey& sec) |