rurban / smhasher

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

MomentChi2 test seems to be broken #126

Closed tevador closed 4 years ago

tevador commented 4 years ago

Compiled with Visual Studio 2019.

All hashes I tested fail MomentChi2 with very high values (>1e+9).

> SMHasher.exe t1ha2_atonce --test=MomentChi2
--- Testing t1ha2_atonce "Fast Positive Hash (portable, aims 64-bit, little-endian)" GOOD

[[[ MomentChi2 Tests ]]]

Analyze hashes produced from a serie of linearly increasing numbers of 32-bit, using a step of 3 ...
Target values to approximate : 38918200.000000 - 410450.000000
Popcount 1 stats : 1391322.120073 - 1030.953528
Popcount 0 stats : 263694225.752220 - 4208096.098738
MomentChi2 for bits 1 :  3.42243e+09
MomentChi2 for bits 0 :  1.09394e+10

Derivative stats (transition from 2 consecutive values) :
Popcount 1 stats : 1391298.179826 - 1030.866239
Popcount 0 stats : 263694337.428723 - 4207984.840833
MomentChi2 for deriv b1 :  3.42244e+09
MomentChi2 for deriv b0 :  1.09397e+10

  FAIL !!!!

*********FAIL*********

Input vcode 0x00000001, Output vcode 0x00000001, Result vcode 0x00000001
Verification value is 0x00000001 - Testing took 29.981000 seconds
> SMHasher.exe sha1-160 --test=MomentChi2
--- Testing sha1-160 "SHA1" GOOD

[[[ MomentChi2 Tests ]]]

Analyze hashes produced from a serie of linearly increasing numbers of 32-bit, using a step of 6 ...
Target values to approximate : 38918200.000000 - 410450.000000
Popcount 1 stats : 1391287.999138 - 2061.763745
Popcount 0 stats : 263696945.359308 - 8416819.141680
MomentChi2 for bits 1 :  3.41389e+09
MomentChi2 for bits 0 :  5.7238e+09

Derivative stats (transition from 2 consecutive values) :
Popcount 1 stats : 1391246.916241 - 2061.409506
Popcount 0 stats : 263695644.231922 - 8415697.369428
MomentChi2 for deriv b1 :  3.4139e+09
MomentChi2 for deriv b0 :  5.72446e+09

  FAIL !!!!

*********FAIL*********

Input vcode 0x00000001, Output vcode 0x00000001, Result vcode 0x00000001
Verification value is 0x00000001 - Testing took 251.685000 seconds
> SMHasher.exe blake3_c --test=MomentChi2
--- Testing blake3_c "BLAKE3 c" GOOD

[[[ MomentChi2 Tests ]]]

Analyze hashes produced from a serie of linearly increasing numbers of 32-bit, using a step of 6 ...
Target values to approximate : 38918200.000000 - 410450.000000
Popcount 1 stats : 1391328.282159 - 2061.812270
Popcount 0 stats : 263693655.492775 - 8416226.451384
MomentChi2 for bits 1 :  3.41388e+09
MomentChi2 for bits 0 :  5.72401e+09

Derivative stats (transition from 2 consecutive values) :
Popcount 1 stats : 1391237.956882 - 2061.934717
Popcount 0 stats : 263702352.344187 - 8417304.231832
MomentChi2 for deriv b1 :  3.4139e+09
MomentChi2 for deriv b0 :  5.72376e+09

  FAIL !!!!

*********FAIL*********

Input vcode 0x00000001, Output vcode 0x00000001, Result vcode 0x00000001
Verification value is 0x00000001 - Testing took 67.303000 seconds
> SMHasher.exe SipHash --test=MomentChi2
--- Testing SipHash "SipHash 2-4 - SSSE3 optimized" GOOD

[[[ MomentChi2 Tests ]]]

Analyze hashes produced from a serie of linearly increasing numbers of 32-bit, using a step of 3 ...
Target values to approximate : 38918200.000000 - 410450.000000
Popcount 1 stats : 1391340.411676 - 1031.054316
Popcount 0 stats : 263695405.661032 - 4208429.792265
MomentChi2 for bits 1 :  3.42243e+09
MomentChi2 for bits 0 :  1.09388e+10

Derivative stats (transition from 2 consecutive values) :
Popcount 1 stats : 1391251.674613 - 1030.873676
Popcount 0 stats : 263699138.573784 - 4208256.457391
MomentChi2 for deriv b1 :  3.42245e+09
MomentChi2 for deriv b0 :  1.09395e+10

  FAIL !!!!

*********FAIL*********

Input vcode 0x00000001, Output vcode 0x00000001, Result vcode 0x00000001
Verification value is 0x00000001 - Testing took 55.951000 seconds
rurban commented 4 years ago

Fixed with ec2baa5, thanks!