Skip to content
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

Key collisions when maxLevels is not a multiple of 8 #22

Open
arnaucube opened this issue Oct 5, 2021 · 1 comment
Open

Key collisions when maxLevels is not a multiple of 8 #22

arnaucube opened this issue Oct 5, 2021 · 1 comment

Comments

@arnaucube
Copy link
Collaborator

By @ed255 in #21 (comment) :

Since you're using the ceiling here, you could find collisions when maxLevels is not a multiple of 8, and you have a len(key) == maxKeyLen where the last bits differ. Is that a problem? A quick solution I can think of is to force the maxLevels to be a multiple of 8. The other solution is to validate that the trailing bits in the key are 0.

@arnaucube
Copy link
Collaborator Author

As a note for the future: having the ability to define maxLevels not being a multiple of 8 is useful, as for example, when working with a zk-circuit, some times it can be more optimal to use 17 levels instead of 32 for a specific use case. So maybe I would go for the option of ensuring trailing bits to be 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant