JS Hash

JS is a bitwise hash function algorithm.



									unsigned int JSHash(char* str, unsigned int length) {
	unsigned int hash = 1315423911;
	unsigned int i = 0;

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

	return hash;
}
								


Example

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


Output

									3189953700