Add SecretKey comparison operator (RIPD-1382)

This commit is contained in:
wilsonianb
2017-01-04 19:20:39 -08:00
committed by seelabs
parent b45f45dcef
commit 2fcde0e0b6
2 changed files with 27 additions and 16 deletions

View File

@@ -68,6 +68,24 @@ public:
to_string() const;
};
inline
bool
operator== (SecretKey const& lhs,
SecretKey const& rhs)
{
return lhs.size() == rhs.size() &&
std::memcmp(lhs.data(),
rhs.data(), rhs.size()) == 0;
}
inline
bool
operator!= (SecretKey const& lhs,
SecretKey const& rhs)
{
return ! (lhs == rhs);
}
//------------------------------------------------------------------------------
/** Produces a sequence of secp256k1 key pairs. */