Skip to content
Reini Urban edited this page Sep 17, 2020 · 7 revisions

This should hopefully be a thorough and uambiguous test of whether a hash is correctly implemented on a given platform. Note that some newer hash are self-seeded (e.g. by using the randomized address of the key), denoted by expected = 0.

The Verification value is calculated by hashing 255 times over messages of [0], [0,1], [0,1,2] ... [0,1,2,...,255] with a reverse seed 255, 254, ... 0. Then the 256 results are treated as array buffer and hashed with another seed, and the Verification value is the hash as uint32_t. This is one of the few tests which runs with varying seeds.

The test is best run by SMHasher --verbose --test=VerifiyAll on all available architectures and variants. I.e. at least 64bit and 32bit, gcc/clang and MSVC, with or without SSE, AVX, ...

When a Verification value is given as 0, then the Verification value computation is skipped, as the hash function itself does the random seeding, and the computed Verification value is not constant. I.e. highwayhash.

Some functions have different Verification values per compiler, then the hash is not considered portable (yet). This happens typically with MSVC or on big-endian, but sometimes even on 32-bit. Some hash functions have different optimized implementations per CPU feature, such as SSE2, SSE4, AVX, ... Then the hash functions need to have the same Verification values per variant (i.e. compiler switch).

The result value should never be 0. This is typically the sign of an Insecure seed

Clone this wiki locally