Skip to main content

spooky_hash

SpookyHash is a public domain noncryptographic hash function producing well-distributed 128-bit hash values for byte arrays of any length.1

This python library is a Cython wrapper for the original C++ implementation. There are both (fast) one-shot hash functions and (slower) hashlib-like hash objects.

Usage

>>> import spooky_hash
>>> print spooky_hash.hash32('hello world')
2617184861
>>> print long(spooky_hash.Hash32('hello ').update('world'))
2617184861

>>> print spooky_hash.hash64('hello world')
14865987102431973981
>>> print long(spooky_hash.Hash64('hello ').update('world'))
14865987102431973981
>>> print spooky_hash.Hash64('hello ').update('world').hexdigest()
5d12ff9b81984ece

>>> print spooky_hash.hash128_long('hello world')
123716849286372619103118623513034416523
>>> print long(spooky_hash.Hash128('hello ').update('world'))
123716849286372619103118623513034416523
>>> print spooky_hash.Hash128('hello ').update('world').hexdigest()
5d12ff9b81984ece25103f0dee88e18b
>>> import binascii
>>> print binascii.hexlify(spooky_hash.hash128('hello world'))
5d12ff9b81984ece25103f0dee88e18b

>>> print spooky_hash.hash32('hello world', seed=4)
4130951021
>>> print spooky_hash.Hash64('hello ', seed=8).update('world').hexdigest()
e54162c401e00c21
>>> print spooky_hash.Hash128('hello ', seed1=15, seed2=16).update('world').hexdigest()
1d46e376a416468b6c5c3a8f3798042b

See also:

http://burtleburtle.net/bob/hash/spooky.html

Metadata

Release files for spooky_hash 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spooky_hash 1.0.1
File Size Uploaded
spooky_hash-1.0.1.tar.gz 39.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spooky_hash 1.0.1
File Interpreter ABI Platform
spooky_hash-1.0.1.macosx-10.9-x86_64.tar.gz Details

Total release size: 60.3 kB

Release files / spooky_hash-1.0.1.tar.gz

Download URL spooky_hash-1.0.1.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
06a193a180c93557a5ce0ac3c0388ae7edb00ff7e2dccb51d270cc5e017da486
BLAKE2b-256 checksum
How to use checksums
291b487d4c1abddd2b07536c234e244aac5544e01ee3a1e2f4fe92d09683404c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / spooky_hash-1.0.1.macosx-10.9-x86_64.tar.gz

Download URL spooky_hash-1.0.1.macosx-10.9-x86_64.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0ff51d2cf1af427caa8788323d3c38ab389617736777240ac73e63cef68f0955
BLAKE2b-256 checksum
How to use checksums
daa068ba85b86ff79ba93b3a4cfcedb540deb74e7b8330dae8e962284b644131
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page