mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
load IdentHash from base32 string
This commit is contained in:
parent
66ff2c7875
commit
ceb2ec1bc0
2 changed files with 9 additions and 1 deletions
|
@ -40,6 +40,12 @@ namespace data
|
||||||
return *this;
|
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 CreateRandomKeys ()
|
||||||
{
|
{
|
||||||
Keys keys;
|
Keys keys;
|
||||||
|
|
|
@ -74,6 +74,8 @@ 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); };
|
||||||
bool operator< (const IdentHash& other) const { return memcmp (m_Hash, other.m_Hash, 32) < 0; };
|
bool operator< (const IdentHash& other) const { return memcmp (m_Hash, other.m_Hash, 32) < 0; };
|
||||||
|
|
||||||
|
bool FromBase32(const std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint8_t m_Hash[32];
|
uint8_t m_Hash[32];
|
||||||
|
|
Loading…
Add table
Reference in a new issue