feat(rabinhash): utility to generate result from random input#157
Merged
hugy718 merged 1 commit intoCOOL-cohort:mainfrom Mar 19, 2025
Merged
feat(rabinhash): utility to generate result from random input#157hugy718 merged 1 commit intoCOOL-cohort:mainfrom
hugy718 merged 1 commit intoCOOL-cohort:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR exports the string hash implementation (RabinHash32) to a CLI utility. This is useful for generating random expected outputs to test the Golang implementation.
Motivation
In COOL, the hash function for string values is implemented by an existing RabinHashFunction32 class.
https://rabinhash.sourceforge.net/com/planetj/math/rabinhash/RabinHashFunction32.html
Since there is no equivalent implementation in Go, we need to port it ourselves (or LLM, of course).
Therefore, in order to test its correctness, we need to ensure that we can generate the same output as those in Java.
Usage
Run
scripts/rabinhash-rand-gen.sh Nto generateNinput-output pairs, separated by spaceThe output is written in hex format. This makes it easy to read in both int32 and uint32.