mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
improved stability
This commit is contained in:
parent
ca51567eba
commit
808d6d1fbf
7 changed files with 62 additions and 39 deletions
|
@ -34,6 +34,7 @@ namespace data
|
|||
{
|
||||
m_RouterIdentity = identity;
|
||||
m_IdentHash = CalculateIdentHash (m_RouterIdentity);
|
||||
UpdateIdentHashBase64 ();
|
||||
m_Timestamp = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
}
|
||||
|
||||
|
@ -124,12 +125,17 @@ namespace data
|
|||
}
|
||||
|
||||
CryptoPP::SHA256().CalculateDigest(m_IdentHash, (uint8_t *)&m_RouterIdentity, sizeof (m_RouterIdentity));
|
||||
UpdateIdentHashBase64 ();
|
||||
}
|
||||
|
||||
void RouterInfo::UpdateIdentHashBase64 ()
|
||||
{
|
||||
size_t l = i2p::data::ByteStreamToBase64 (m_IdentHash, 32, m_IdentHashBase64, 48);
|
||||
m_IdentHashBase64[l] = 0;
|
||||
memcpy (m_IdentHashAbbreviation, m_IdentHashBase64, 4);
|
||||
m_IdentHashAbbreviation[4] = 0;
|
||||
}
|
||||
|
||||
|
||||
void RouterInfo::WriteToStream (std::ostream& s)
|
||||
{
|
||||
s.write ((char *)&m_RouterIdentity, sizeof (m_RouterIdentity));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue