mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-06-14 01:56:52 +02:00
common MixHash and MixKey
This commit is contained in:
parent
b2f0278180
commit
9f2a2e44a3
7 changed files with 36 additions and 42 deletions
|
@ -39,21 +39,6 @@ namespace transport
|
|||
delete[] m_SessionConfirmedBuffer;
|
||||
}
|
||||
|
||||
void NTCP2Establisher::MixKey (const uint8_t * inputKeyMaterial)
|
||||
{
|
||||
i2p::crypto::HKDF (m_CK, inputKeyMaterial, 32, "", m_CK);
|
||||
// ck is m_CK[0:31], k is m_CK[32:63]
|
||||
}
|
||||
|
||||
void NTCP2Establisher::MixHash (const uint8_t * buf, size_t len)
|
||||
{
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init (&ctx);
|
||||
SHA256_Update (&ctx, m_H, 32);
|
||||
SHA256_Update (&ctx, buf, len);
|
||||
SHA256_Final (m_H, &ctx);
|
||||
}
|
||||
|
||||
void NTCP2Establisher::KeyDerivationFunction1 (const uint8_t * pub, i2p::crypto::X25519Keys& priv, const uint8_t * rs, const uint8_t * epub)
|
||||
{
|
||||
static const uint8_t protocolNameHash[] =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue