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.
The cp32 spec says that the hash of a string X is the xor of rotl(g(xi), |X|-i+1) for each i in 0..|X|-1.
That means that the first g value gets rotl'd by |X|+1 bits, the second gets rotl'd by |X| bits, the third by |X|-1 bits, and so on, until the last g value gets rotl'd by 2 bits.
This seems like it might be a simple typo, and the
+1
should perhaps be a-1
. Then the first g value gets rotl'd by |X|-1 bits, then |X|-2, and so on until the last g value gets rotl'd by 0 bits.Was that in fact the intent?
(With the advent of iterators in Go 1.23, I went back to my hashsplit package to update its API. In the process I rediscovered this old PR draft and so decided to take the advice in it and add my own implementation of cp32, which is why I'm looking at this again after all this time.)