Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Poseidion sponge skips a permutation in a certain condition:
So that it returns same elements in subsequent calls which is demonstrated in the first commit of this PR. Problem is fixed in the next commit. I also added a simpler independent implementation to apply cross fuzz test and must be removed when this PR matures. I've checked and asked around if any production project uses
PoseidonSponge
at the moment but don't see any and I think this PR is safe to be opened.I also come across another strange behaviour which I feel that it is not intended. In a such condition:
It applies a useless permutation rather than jsut returning an empty output vector. I've also filed this it in the comments of cross implementation.
Another thing I would like to add as discussion is that squeezing 0 elements in absorb mode changes the mode to squeeze. So for example output of
absorb(3), absorb(4), squeeze(1)
is not the same asabsorb(6), squeeze(0), absorb(1), squeeze(1)
This would be intended but I find allowing to squueze 0 elements confusing as an api user.Pending
section inCHANGELOG.md
Files changed
in the Github PR explorer