pre-calculated h

pull/1553/merge
orignal 4 years ago
parent 1c7780a423
commit 7e874eaa7c

@ -152,8 +152,13 @@ namespace tunnel
void InitBuildRequestRecordNoiseState (i2p::crypto::NoiseSymmetricState& state)
{
static const char protocolName[] = "Noise_N_25519_ChaChaPoly_SHA256"; // 31 chars
static const uint8_t hh[32] =
{
0x69, 0x4d, 0x52, 0x44, 0x5a, 0x27, 0xd9, 0xad, 0xfa, 0xd2, 0x9c, 0x76, 0x32, 0x39, 0x5d, 0xc1,
0xe4, 0x35, 0x4c, 0x69, 0xb4, 0xf9, 0x2e, 0xac, 0x8a, 0x1e, 0xe4, 0x6a, 0x9e, 0xd2, 0x15, 0x54
}; // SHA256 (protocol_name || 0)
memcpy (state.m_CK, protocolName, 32); // ck = h = protocol_name || 0
SHA256 (state.m_CK, 32, state.m_H); // h = SHA256(h);
memcpy (state.m_H, hh, 32); // h = SHA256(h)
}
}
}
Loading…
Cancel
Save