Hashing an IP address to a number in [0, H)
问题 I'm using Python-2.6. I have very little knowledge of hash functions. I want to use a CRC hash function to hash an IP address like '128.0.0.5' into the range [0, H). Currently I'm thinking of doing zlib.crc32('128.0.0.5')%H. Is this okay? There's a few ques. you could try and answer... does it make any diff. if I hash '128.0.0.5' or its binary '0001110101010..' whatever that is or without the '.'s zlib.crc32 returns a signed integer. Does modding (%) a neg. with a positive H always give a pos