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:
1 file changed
+8
-6
@@ -133,18 +133,20 @@ BOOST_AUTO_TEST_CASE(siphash)
|
|||||||
// Check consistency between CSipHasher and SipHashUint256[Extra].
|
// Check consistency between CSipHasher and SipHashUint256[Extra].
|
||||||
FastRandomContext ctx;
|
FastRandomContext ctx;
|
||||||
for (int i = 0; i < 16; ++i) {
|
for (int i = 0; i < 16; ++i) {
|
||||||
|
uint64_t k0 = ctx.rand64();
|
||||||
uint64_t k1 = ctx.rand64();
|
uint64_t k1 = ctx.rand64();
|
||||||
uint64_t k2 = ctx.rand64();
|
|
||||||
uint256 x = m_rng.rand256();
|
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();
|
uint32_t n = ctx.rand32();
|
||||||
uint8_t nb[4];
|
uint8_t nb[4];
|
||||||
WriteLE32(nb, n);
|
WriteLE32(nb, n);
|
||||||
CSipHasher sip256(k1, k2);
|
|
||||||
sip256.Write(x);
|
|
||||||
CSipHasher sip288 = sip256;
|
|
||||||
sip288.Write(nb);
|
sip288.Write(nb);
|
||||||
BOOST_CHECK_EQUAL(SipHashUint256(k1, k2, x), sip256.Finalize());
|
BOOST_CHECK_EQUAL(SipHashUint256Extra(k0, k1, x, n), sip288.Finalize()); // TODO modified in follow-up commit
|
||||||
BOOST_CHECK_EQUAL(SipHashUint256Extra(k1, k2, x, n), sip288.Finalize());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user