Description
Issue description:
Replace the hash function used in YJIT from the default SipHash in the standard library to a faster alternative.
Motivation:
YJIT currently uses HashMap and HashSet from the standard library, which utilize SipHash by default. While SipHash is collision-resistant, it is relatively slow. Replacing it with a faster hash function, even at the cost of reduced collision resistance, may improve performance.
Task:
- Introduce a faster hash library, such as AHash or FxHash
- Set the seed value randomly at initialization to prevent predictable hash collisions and mitigate hash flooding attacks
Concerns:
Switching to a faster, non-collision-resistant hash function may increase the risk of hash flooding attacks. To mitigate this, careful implementation and random seeding will be required.
For example, Node.js faced a hash flooding vulnerability in the past: https://v8.dev/blog/hash-flooding.
Conclusion:
I welcome feedback, especially regarding potential security concerns or implementation suggestions. Thank you.