Hash Tool

Each line from input is hashed with the specified hashing algorithm, based on this.

Algorithm:

Alternate version of djb2 using xor instead of addition. Uses hash(i) = hash(i - 1) * 33 ^ str[i]; the magic of number 33 (why it works better than many other constants, prime or not) has never been adequately explained.

This algorithm (k=33) was first reported by dan bernstein many years ago in comp.lang.c. Uses hash(i) = hash(i - 1) * 33 + str[i]; the magic of number 33 (why it works better than many other constants, prime or not) has never been adequately explained.

This algorithm was created for sdbm (a public-domain reimplementation of ndbm) database library. It was found to do well in scrambling bits, causing better distribution of the keys and fewer splits. It also happens to be a good general hashing function with good distribution. The actual function is hash(i) = hash(i - 1) * 65599 + str[i]. The magic constant 65599 was picked out of thin air while experimenting with different constants, and turns out to be a prime.

This hash function appeared in K&R; (1st ed) but at least the reader was warned: "This is not the best possible algorithm, but it has the merit of extreme simplicity." This is an understatement; It is a terrible hashing algorithm, and it could have been much better without sacrificing its "extreme simplicity." [see the second edition!] Many C programmers use this function without actually testing it, or checking something like Knuth's Sorting and Searching, so it stuck.

CRCs are specifically designed to protect against common types of errors on communication channels, where they can provide quick and reasonable assurance of the integrity of messages delivered. However, they are not suitable for protecting against intentional alteration of data.

MurmurHash is a non-cryptographic hash function suitable for general hash-based lookup. Wikipedia