GeneralHashFunctions

package module
v0.0.0-...-0600e84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 1 Imported by: 1

README

GeneralHashFunctions

A Go library that implements General Hash Functions.

refer: http://www.partow.net/programming/hashfunctions/index.html

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APHash

func APHash(str string) uint

APHash: An algorithm produced by me Arash Partow.

		   I took ideas from all of the above hash functions making a hybrid rotative and additive hash function algorithm.
        There isn't any real mathematical analysis explaining why one should use this hash function instead of the others described above
        other than the fact that I tired to resemble the design as close as possible to a simple LFSR.
        An empirical result which demonstrated the distributive abilities of the hash algorithm was obtained using a hash-table with 100003 buckets,
        hashing The Project Gutenberg Etext of Webster's Unabridged Dictionary, the longest encountered chain length was 7,
        the average chain length was 2, the number of empty buckets was 4579.

func BKDRHash

func BKDRHash(str string) uint

BKDRHash: This hash function comes from Brian Kernighan and Dennis Ritchie's book "The C Programming Language".

It is a simple hash function using a strange set of possible seeds which all constitute a pattern of 31....31...31 etc,
it seems to be very similar to the DJB hash function.

func BPHash

func BPHash(str string) uint

func DEKHash

func DEKHash(str string) uint

DEKHash: An algorithm proposed by Donald E. Knuth in The Art Of Computer Programming Volume 3,

under the topic of sorting and search chapter 6.4.

func DJBHash

func DJBHash(str string) uint

DJBHash: An algorithm produced by Professor Daniel J. Bernstein and shown first to the world on the usenet newsgroup comp.lang.c.

It is one of the most efficient hash functions ever published.

func ELFHash

func ELFHash(str string) uint

ELFHash: Similar to the PJW Hash function, but tweaked for 32-bit processors. It is a widley used hash function on UNIX based systems.

func FNVHash

func FNVHash(str string) uint

func JSHash

func JSHash(str string) uint

JSHash is a bitwise hash function written by Justin Sobel

func PJWHash

func PJWHash(str string) uint

PJWHash: This hash algorithm is based on work by Peter J. Weinberger of Renaissance Technologies.

The book Compilers (Principles, Techniques and Tools) by Aho, Sethi and Ulman,
recommends the use of hash functions that employ the hashing methodology found in this particular algorithm.

func RSHash

func RSHash(str string) uint

RSHash from Robert Sedgwicks Algorithms

func SDBHash

func SDBHash(str string) uint

SDBHash: This is the algorithm of choice which is used in the open source SDBM project.

The hash function seems to have a good over-all distribution for many different data sets.
It seems to work well in situations where there is a high variance in the MSBs of the elements in a data set.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL