Hash Analysis Tool

Last published: August 15, 2013 by 'valloud'

Hash Analysis Tool.

This tool analyzes hash quality for given object data sets. It can automate determining the following bits of information.

* Number of collisions.

* Collision rate (objects per hash value).

* Hash quality (where 100% means zero collisions, 50% means one collision every two objects).

* Normalized chi square for hash values (optimum is zero, higher is worse).

* Normalized chi square modulo a variety of primes (optimum is zero, higher is worse ---

note that achieving the optimum value in this case cannot be expected in practice).

This is done because even if you have a hash with low overall collisions, the idea

is that there are still low collisions when you look at those values modulo the size

of the hash table. In practice, look for values < 1 especially when the load factor is

less than around 0.7 or 0.8.

* Average block size for many prime hash table values. This measures the length of runs of not

nil objects in a hashed collection that uses open addressing, and it is meant to predict linear

probing performance. For hash functions that are not perfect and mean to behave like a random

number generator mod p, compare the values calculated to those obtained by testing a random

number generator such as the Lagged Fibonacci generator in VW 7.6. This functionality was

contributed by Martin McClure.

* Assorted timings of hash calculations.

* The ability to automatically profile the hash calculation.

* Whether the data set contains objects such that x = y but x hash ~= y hash.

To use the tool, simply evaluate HashAnalysisToolUI open. To quickly test instances of a particular class, right click on

the data set list and add an adhoc data set. Select a hash function from the drop down below and hit Analyze Hash. The

comparison tool was contributed by Holger Kleinsorgen.

A more detailed manual can be found here: ftp://sqrmax.us.to/pub/Papers/Hash%20Analysis%20Tool.pdf.

For more information, the author would like to suggest the following book:

Hashing in Smalltalk: Theory and Practice

http://www.lulu.com/spotlight/avsmalltalkbooks

While the author of the tool is also the author of the book above, independent review of the book by numerous readers

indicates that it is indeed suitable for serious research into these matters. Hopefully the reader will agree.

Enjoy!

Copyright (c) 2008 by Andres Valloud

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.