test: rename k1/k2 to k0/k1 in SipHash consistency tests

Aligns test variable naming with the `k0`/`k1` convention used consistently throughout the codebase for `SipHash` keys.
Also splits the single-param `SipHash` test from the one with extra, for clarity.
This commit is contained in:
Lőrinc
2025-02-01 19:01:36 +01:00
parent 29ed608dc7
commit 9f9eb7fbc0

View File

@@ -133,18 +133,20 @@ BOOST_AUTO_TEST_CASE(siphash)
// Check consistency between CSipHasher and SipHashUint256[Extra].
FastRandomContext ctx;
for (int i = 0; i < 16; ++i) {
uint64_t k0 = ctx.rand64();
uint64_t k1 = ctx.rand64();
uint64_t k2 = ctx.rand64();
uint256 x = m_rng.rand256();
CSipHasher sip256(k0, k1);
sip256.Write(x);
BOOST_CHECK_EQUAL(SipHashUint256(k0, k1, x), sip256.Finalize()); // TODO modified in follow-up commit
CSipHasher sip288 = sip256;
uint32_t n = ctx.rand32();
uint8_t nb[4];
WriteLE32(nb, n);
CSipHasher sip256(k1, k2);
sip256.Write(x);
CSipHasher sip288 = sip256;
sip288.Write(nb);
BOOST_CHECK_EQUAL(SipHashUint256(k1, k2, x), sip256.Finalize());
BOOST_CHECK_EQUAL(SipHashUint256Extra(k1, k2, x, n), sip288.Finalize());
BOOST_CHECK_EQUAL(SipHashUint256Extra(k0, k1, x, n), sip288.Finalize()); // TODO modified in follow-up commit
}
}