ELF Hash

ELF is a hash function algorithm.



									public static uint ELFHash(string str)
{
	uint hash = 0;
	uint x = 0;
	uint i = 0;

	for (i = 0; i < str.Length; i++)
	{
		hash = (hash << 4) + ((byte)str[(int)i]);
		
		if ((x = hash & 0xF0000000) != 0)
		{
			hash ^= (x >> 24);
		}
		
		hash &= ~x;
	}

	return hash;
}
								


Example

									string data = "jdfgsdhfsdfsd 6445dsfsd7fg/*/+bfjsdgf%$^";
uint value = ELFHash(data);
								


Output

									248446350