DJB Hash

DJB is a hash function algorithm.



									unsigned int DJBHash(char* str, unsigned int length) {
	unsigned int hash = 5381;
	unsigned int i = 0;

	for (i = 0; i < length; str++, i++)
	{
		hash = ((hash << 5) + hash) + (*str);
	}

	return hash;
}
								


Example

									char* data = "jdfgsdhfsdfsd 6445dsfsd7fg/*/+bfjsdgf%$^";
unsigned int value = DJBHash(data, 40);
								


Output

									2562861588