Browse Source

compute IdentHash in Identity method

pull/59/head
cpubug 11 years ago
parent
commit
a82bd628c1
  1. 7
      Identity.cpp
  2. 3
      Identity.h

7
Identity.cpp

@ -26,6 +26,13 @@ namespace data
return count == sizeof(Identity); return count == sizeof(Identity);
} }
IdentHash Identity::Hash()
{
IdentHash hash;
CryptoPP::SHA256().CalculateDigest(reinterpret_cast<uint8_t*>(&hash), reinterpret_cast<uint8_t*> (this), sizeof (Identity));
return hash;
}
PrivateKeys& PrivateKeys::operator=(const Keys& keys) PrivateKeys& PrivateKeys::operator=(const Keys& keys)
{ {
pub = keys; pub = keys;

3
Identity.h

@ -9,6 +9,8 @@ namespace i2p
{ {
namespace data namespace data
{ {
class IdentHash;
#pragma pack(1) #pragma pack(1)
struct DHKeysPair // transient keys for transport sessions struct DHKeysPair // transient keys for transport sessions
@ -33,6 +35,7 @@ namespace data
Identity& operator=(const Keys& keys); Identity& operator=(const Keys& keys);
bool FromBase64(const std::string&); bool FromBase64(const std::string&);
IdentHash Hash();
}; };
struct PrivateKeys // for eepsites struct PrivateKeys // for eepsites

Loading…
Cancel
Save