Open orlp opened 5 months ago
Thanks a lot for this analysis @orlp! Let's see if we can improve DoS resistance without compromising performance. I don't know if it can be made 100% proof but I'm sure it can be improved (maybe using the seed in the main construction).
Btw DoS resistance is not advertised (unless I missed something?). See in readme:
This does not mean however that it is completely DOS resistant. This has to be analyzed further.
Btw DoS resistance is not advertised
I disagree. The way it is worded it sounds like it has some DoS resistance when there is none at all. Similarly with multicollision resistance.
Let's see first if we can address this 😄 Feel free to submit a PR if you want. After that, depending on the results, we can reword the DoS resistance section more accurately.
Did not has much time to work on this, so in the meantime I've clarified the DOS resistance part in the readme https://github.com/ogxd/gxhash?tab=readme-ov-file#security
There are probably other issues as well, but this line is particularly problematic:
https://github.com/ogxd/gxhash/blob/8bee61e33d2feb78dc076413d10d66929de2face/src/gxhash/platform/x86.rs#L86
This is trivial to invert and allows you to create arbitrary seed-independent multicollisions. I would suggest not advertising DoS resistance on this hash at all.