-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test for "blinding multiplication" #99
Comments
@wangyi-fudan, FYI. |
@gzm55, FYI |
Dear leo-yuriev: |
Dear @wangyi-fudan, as I commented wangyi-fudan/wyhash#49: The actual chance is 2^-63 per each multiplication. Moreover, the later a zero rolls, (then) the greater the losses will be. For example, if a zero rolls at the end of the main loop, then the 1/4 of the data will be lost. For many applications, this is an unacceptable flaw. Therefore, users should know about the price of speed, in order to make their own conclusions and assess the risks (regardless of how you assess the severity of the problem). Now SMHasher includes a table listing many drawbacks of hash functions, and many developers use this information to select hash functions. Therefore, it is irresponsible to keep silent about an aspect, especially if it is simple enough to explain it. In addition, most (seem with single exception) hash function designers consider it unacceptable to intentionally leave a such known flaws (especially when ones are obviously). |
I updated wyhash readme to state this limitation. |
@leo-yuriev What should be the proper abbreviation for this flaw for the rhs comments? blind mult? |
Nothing better comes to mind |
well, I suggest that any flaw statement should come with a testable code and apply it on every hash function. We can not use mouth/words only. |
This problem is fully solved: |
Only in wyhash, but for about half of the others hashes not. |
@rurban, I have a few ideas for such a test and an intention to do it. |
As for the PRVHASH, this isn't a problem if |
I would at least give devs the possibilty to skip a list of bad seeds, they are getting from an initial rand. And list the hashes which are vulnerable to bad seeds (with a very low percentage indeed, 1-2 of 2^32 or 2^64). This would not affect the hash performance, only the init call needs to reject a bad seed. Write more such seed_init() calls. eg clhash skips its bad seeds in |
started with for wyhash and clhash. See GH #99
for now just exhaustive, against some simple 16byte keys. need to check the bad_seeds lists also, as these tests will actually terminate See GH #99
I called the new test BadSeeds, and will add the list of bad seeds to the static HashInfo list in main.cpp. wyhash32 has eg {0x1bc1d52e, 0x1cbc261d, 0x33a0d1d9, 0x429dacdd, 0xd637dbf3} waiting for confirmation will need a few days of CPU |
Just a note, latest PRVHASH has no "bad" seeds at all... prvhash64s even starts at "full zero" state. |
started with for wyhash and clhash. See GH #99
for now just exhaustive, against some simple 16byte keys. need to check the bad_seeds lists also, as these tests will actually terminate See GH #99
I've added now all known bad seeds to Special care needs to be taken for crc, FNV1 variants, fletcher, Jenkins, and with GOOD hashes all MUM variants, like mirhash, MUM, wyhash32. |
Now, wyhash has removed the default secret. Thus it is hard to break. |
I've been trying to figure out how to properly use the BadSeeds test in my fork of smhasher (it includes so much experimental junk that there's no point in cleaning it up for PRs, sorry about that). I have a hash that's very similar to a reduced-bit-size version of wyhash (WaterHash) and another that's a little different, but still somewhat mum-type (WootHash). I'm pretty sure the first of these has bad seeds, but I'm not sure how to send billions of possible seeds (like all with 0 in the lower 32 bits) to BadSeeds to check. The second of these might not qualify as "blind" multiplication, so it could be resistant or immune to this issue -- or it might not, so it would be great to be able to scan for problematic seeds. |
I recently briefly described the "blinding multiplication" flaw of NH-approach hash functions. This seems to be an obvious thing, but many users do not know about it and have no idea about the possible consequences.
This looks to me to be a rather serious drawback, despite the low probability, since some of the data does not affect the hash value at all (e.g. wyhash case).
I think we need to come up with some kind of test that would allow us to clearly identify such flaws.
The text was updated successfully, but these errors were encountered: