Skip to content

feat(rabinhash): utility to generate result from random input#157

Merged
hugy718 merged 1 commit intoCOOL-cohort:mainfrom
tinyAdapter:main
Mar 19, 2025
Merged

feat(rabinhash): utility to generate result from random input#157
hugy718 merged 1 commit intoCOOL-cohort:mainfrom
tinyAdapter:main

Conversation

@tinyAdapter
Copy link
Contributor

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 N to generate N input-output pairs, separated by space

The output is written in hex format. This makes it easy to read in both int32 and uint32.

@hugy718 hugy718 merged commit 9f0a567 into COOL-cohort:main Mar 19, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants