libamxc
1.10.3
C Generic Data Containers
|
Functions | |
unsigned int | amxc_RS_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_JS_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_PJW_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_ELF_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_BKDR_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_SDBM_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_DJB_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_DEK_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_BP_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_FNV_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int | amxc_AP_hash (const char *str, const unsigned int len) |
Calculate a hash from a string. More... | |
unsigned int amxc_AP_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
An algorithm produced by Arash Partow. He 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 tried 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.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 185 of file amxc_hash_func.c.
unsigned int amxc_BKDR_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
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.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 118 of file amxc_hash_func.c.
unsigned int amxc_BP_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
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.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 162 of file amxc_hash_func.c.
unsigned int amxc_DEK_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
A simple hash function from Robert Sedgwicks Algorithms in C book.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 152 of file amxc_hash_func.c.
unsigned int amxc_DJB_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
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.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 141 of file amxc_hash_func.c.
unsigned int amxc_ELF_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
Similar to the PJW Hash function, but tweaked for 32-bit processors. Its the hash function widely used on most UNIX systems.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 102 of file amxc_hash_func.c.
unsigned int amxc_FNV_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
A simple hash function from Robert Sedgwicks Algorithms in C book.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 172 of file amxc_hash_func.c.
unsigned int amxc_JS_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
A bitwise hash function written by Justin Sobel TODO: What happens if str is NULL?
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 71 of file amxc_hash_func.c.
unsigned int amxc_PJW_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
This hash algorithm is based on work by Peter J. Weinberger of AT&T Bell Labs. 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.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 82 of file amxc_hash_func.c.
unsigned int amxc_RS_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
A simple hash function from Robert Sedgwicks Algorithms in C book. TODO: What happens if str is NULL?
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 57 of file amxc_hash_func.c.
unsigned int amxc_SDBM_hash | ( | const char * | str, |
const unsigned int | len | ||
) |
Calculate a hash from a string.
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.
str | a string that needs to be hashed |
len | the length that must be used of the string to calculate the hash |
Definition at line 130 of file amxc_hash_func.c.