Browse Source

load IdentHash from base32 string

pull/70/head
cpubug 11 years ago
parent
commit
ceb2ec1bc0
  1. 6
      Identity.cpp
  2. 4
      Identity.h

6
Identity.cpp

@ -40,6 +40,12 @@ namespace data @@ -40,6 +40,12 @@ namespace data
return *this;
}
bool IdentHash::FromBase32(const std::string& s)
{
size_t count = Base32ToByteStream(s.c_str(), s.length(), m_Hash, sizeof(m_Hash));
return count == sizeof(m_Hash);
}
Keys CreateRandomKeys ()
{
Keys keys;

4
Identity.h

@ -73,7 +73,9 @@ namespace data @@ -73,7 +73,9 @@ namespace data
bool operator== (const IdentHash& other) const { return !memcmp (m_Hash, other.m_Hash, 32); };
bool operator< (const IdentHash& other) const { return memcmp (m_Hash, other.m_Hash, 32) < 0; };
bool FromBase32(const std::string&);
private:
uint8_t m_Hash[32];

Loading…
Cancel
Save