-
Notifications
You must be signed in to change notification settings - Fork 256
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
Replace Ahash with Fnv for Hashbrown #825
Conversation
How about we use SipHash for non-atomic platforms, and ahash elsewhere? |
To be honest I'm not sure from top of my head if I can make cargo dependency optional based on whether a platform has atomics. Will try |
Another question is whether or not try to include aHash with or without randomization if it's done as external dependency instead of default hash in hashbrown. Hashbrown itself doesn't have and option to continue aHash's features, but maybe it can be imported independently and without randomization is may have no atomics by itself |
I think it's possible like so: https://github.com/PyO3/pyo3/blob/fe79f548174eb8108813f202bb0df9428ddfd806/Cargo.toml#L48 |
restored features (inlines) on hashbrown + ahash is used on platforms with atomics |
Hi! Can anyone give me some pointers on why the |
Mainly because it was using atomics and would not compile on some platforms |
Thanks for the prompt answer! |
I didn’t check FoldHash. The main problem was that aHash was seeded, and seeing mechanism itself used atomics. So it may apply to FoldHash too as seeding is standard mechanism to avoid timing attacks on hash maps if queries could be externally provided/uncontrolled. For arkworks it’s not needed, but default configuration was to use such mechanism |
Thanks a lot for the pointers! I just checked the seeding mechanism in FoldHash here and it seems they provide a fixed global state for the platforms that do not support atomics. In that case, I can go ahead and enable |
Hi again! I would be very grateful if you could look into this. |
What’s the interest for the default hasher? It’s just a feature flag and only provides few extra constructor methods. Maybe Default::default() starts to work, but not sure. At the moment I do not have capacity to check building on atomic-free platforms. Seeding code will most likely work, but it also depends if hashbrown doesn’t do some manual seeding itself |
Thanks for the answer. I will need this in some other repos of arkworks as well. |
Alternative to #824 , will fix #812 too for systems without atomics. Fnv provides no key randomization, but it shouldn't be required for commitment scheme.
Pending
section inCHANGELOG.md
Files changed
in the GitHub PR explorer