-
Notifications
You must be signed in to change notification settings - Fork 204
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
Add HashMap collection #4241
Labels
enhancement
New feature or request
Comments
github-merge-queue bot
pushed a commit
that referenced
this issue
Feb 23, 2024
# Description This PR shall bring HashMap into the `stdlib` of Noir. ## Problem\* Resolves #4241 ## Summary\* Implementation of `HashMap` with open addressing and quadratic probing scheme. Since Noir requires knowing loop bounds (and recursive calls) at compile time, `HashMap` is of fixed capacity and **no** dynamic resize is accomplished with regard to load factor. Furthermore, contribution includes implementation of `PedersenHasher` to be used for now. One can examine potentially better and less heavy prehash functions. I tried to conform with best practices of engineering, however since Noir is in rapid development, there are certain things which may be optimized in future, both from the code style and performance point of view. ## Additional Context I put the `PedersenHasher` among the `poseidon.nr` and `mimc.nr`, so one can consider moving declaration of other pedersen-related functionality there, however that would be a breaking change. ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [x] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 14, 2024
# Description ## Problem\* Resolves a TODO in #4241 ## Summary\* Adds the remaining Hash impls for primitive types in the stdlib ## Additional Context I've marked this as "no documentation needed" but we should probably document somewhere that these types are hashable. Where should this go? The existing "hash methods" page doesn't seem to fit. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
It is an essential attribute of each language to have an opportunity to utilize hash table for distinct purposes. Furthermore, it would be a valuable asset to have in ZK environment, considering integration boost with other protocols due to increased feasibility to implement state tries - latter as graphs, may be stored and operated efficiently in hash table form internally.
Happy Case
Basic trait declaring the set of essential operations may look the following way:
Alternatives Considered
No response
Additional Context
Since Noir is heavily inspired by Rust, in this contribution one port distinct hash-related traits, such as
BuildHasher
,Hasher
andHash
to add flexibility inHashMap
implementation.Would you like to submit a PR for this Issue?
Yes
Support Needs
No response
The text was updated successfully, but these errors were encountered: