rurban / smhasher

Hash function quality and speed tests
https://rurban.github.io/smhasher/
Other
1.85k stars 178 forks source link

I break t1ha using practrand #54

Closed wangyi-fudan closed 5 years ago

wangyi-fudan commented 5 years ago

Hi, I used Lemire's https://github.com/lemire/testingRNG to break t1ha. The trick is to transform a hash function to a PRNG, and test it using mature PRNG tests, such as testU01 and practrand. I edited testxorshift128plus.c with the following code : //#include "xorshift128plus.h"

include "t1ha.c"

uint64_t seed, zero=0; void xorshift128plus_seed(uint64_t s){ seed=s; } uint64_t xorshift128plus(void){ seed++; return t1ha(&zero, 8, seed); }

in this way, t1ha is forced to act as a PRNG using his weak seed. And practrand crushed the original t1ha and t1ha1_le. However, t1ha2_atonce seems to survive. This trick may be incorporated to SMHasher to crush more hash function.

Bulat-Ziganshin commented 5 years ago

What you mean by "break"? Did you find collision that is independent of seed? Or did you just find a collision for a fied seed which is very easy for ANY 64-bit hash, given modern cpu speeds?