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

When using Poseidon hash, different bytearray-keys can lead to same values in the tree #23

Open
arnaucube opened this issue Oct 5, 2021 · 0 comments

Comments

@arnaucube
Copy link
Collaborator

example:
0x0100 interpreted in little-endian bigint is 1, 0x01000000 interpreted in little-endian bigint is 1 (same would happen in big-endian with 0x0001 and 0x00000001).

This affects when adding & updating & getting leafs from the tree, and also when checking merkle-proofs.

One option could be that if the tree uses Poseidon as hashFunc, force the input keys to be of 32 bytes (32-byte little-endian representation of a bigint).

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