The Gasher

This is a hasher, a fuzzer, and genetic algorithm. This tool generates formulas (in JS code) to map a given set of inputs (numbers) to a perfect minimal lookup table.

For example, the values `10, 20, 30, 40` map to a perfect hash with the mapper formula `n => n / 10 - 1` to `{0: 10, 1: 20, 2: 30, 3: 40}`. You can validate the result with this tool here. There is another example page, I think it's older?

By Peter van der Zee, © pvdz.ee, July 2016. See github.com/pvdz/gasher for code/readme and pvdz.ee/weblog/376 for blog post.

values to hash (JS code, results in JS array of numbers)
(The above resulted in...) len=
formula values (x=current)
weights; current: best:
formula prefixes
weights; current: best:
formula infixes
weights; current: best:



Bucket Clamping:



Particles: Buckets: Append:



above: last of batch, always replaced
below: best so far. equals are replaced until better than some score and appended otherwise