Python - Website

Python's hash function is a variant of FNV. According to the comments in their dict implementation, their collision resolution is the most important part, so it's possible that the flaws of the FNV algorithm work in their favor. I'm not aware of any tests showing this to be true though.

Tests

Implementation

finline u32 fastcall Python( const u8 *key, u32 len, u32 seed ) {
	u32 hash = (*key << 7) + seed + len;
	for ( ; len & ~1; len -= 2, key += 2 )
		hash = ( ( ( hash * 1000003 ) ^ key[0] ) * 1000003 ) ^ key[1];
	if ( len & 1 )
		hash = ( hash * 1000003 ) ^ key[0];
	return hash;
}