Skip to content

Commit

Permalink
load IdentHash from base32 string
Browse files Browse the repository at this point in the history
  • Loading branch information
cpubug committed Apr 23, 2014
1 parent 66ff2c7 commit ceb2ec1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion Identity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit ceb2ec1

Please sign in to comment.