SpookyHash v2的Python包装器
spooky_hash的Python项目详细描述
SpookyHash is a public domain noncryptographic hash function producing well-distributed 128-bit hash values for byte arrays of any length.1
这个Python库是一个用于原始C++的Cython包装器 实施。有两个(快速)一次性哈希函数和 (较慢)类似hashlib的散列对象。
用法
>>>importspooky_hash>>>printspooky_hash.hash32('hello world')2617184861>>>printlong(spooky_hash.Hash32('hello ').update('world'))2617184861>>>printspooky_hash.hash64('hello world')14865987102431973981>>>printlong(spooky_hash.Hash64('hello ').update('world'))14865987102431973981>>>printspooky_hash.Hash64('hello ').update('world').hexdigest()5d12ff9b81984ece>>>printspooky_hash.hash128_long('hello world')123716849286372619103118623513034416523>>>printlong(spooky_hash.Hash128('hello ').update('world'))123716849286372619103118623513034416523>>>printspooky_hash.Hash128('hello ').update('world').hexdigest()5d12ff9b81984ece25103f0dee88e18b>>>importbinascii>>>printbinascii.hexlify(spooky_hash.hash128('hello world'))5d12ff9b81984ece25103f0dee88e18b>>>printspooky_hash.hash32('hello world',seed=4)4130951021>>>printspooky_hash.Hash64('hello ',seed=8).update('world').hexdigest()e54162c401e00c21>>>printspooky_hash.Hash128('hello ',seed1=15,seed2=16).update('world').hexdigest()1d46e376a416468b6c5c3a8f3798042b