Implementation of the Jump Consistent Hash algorithm
Project description
Python implementation of the jump consistent hash algorithm by John Lamping and Eric Veach[1]. Requires Python 2.6-2.7 or 3.2+.
Usage
>>> import jump
>>> jump.hash(256, 1024)
520
Or if you want to use the C++ extension:
>>> jump.fasthash(256, 1024)
520
If you want to use a str as a key instead of an int, you can pass it through a hash function to compute a real key. Here’s a couple of examples using Python 3:
>>> import hashlib
>>> int(hashlib.md5(b'127.0.0.1').hexdigest(), 16)
325870950296970981340734819828239218902
>>> int(hashlib.sha1(b"127.0.0.1").hexdigest(), 16)
431133456357828263809343936597625557575256328153
>>> import binascii
>>> binascii.crc32(b'127.0.0.1') & 0xffffffff
3619153832
>>> abs(hash('127.0.0.1'))
7536019783825143230
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for jump_consistent_hash-2.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12213f45a97a73313ea238e6a08a0a6b093b0d2f748c7a344cd5352650968dbb |
|
MD5 | cf33fa84032c851b54e4913f8edea31a |
|
BLAKE2b-256 | a760b01a7a92b9ca108b912d19dd0f2902d22270f3b07d9838e449c0ac5c65a2 |
Close
Hashes for jump_consistent_hash-2.0.3-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efda81c98dff71cea5d86d76971b54c2e222815b702c8043e0f9c91d692697a6 |
|
MD5 | aac2d833db0cc7a1c37e9679a155af3e |
|
BLAKE2b-256 | 574d7ce679f87a4e723a02dade60d77ca07c903e6b39a6ba85b1c8533c537690 |
Close
Hashes for jump_consistent_hash-2.0.3-cp27-none-macosx_10_11_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49f10ad94e08f626d3ac777569994d7421dc8675d405c32b0d5560c7fb7a3a6a |
|
MD5 | 4767b695fc6c9cb5049f11a667f276a6 |
|
BLAKE2b-256 | 8a475e095ae21fbc2d9b1a9534120e0b2c5b954ba39c58129321dd66f4f70ef8 |
Close
Hashes for jump_consistent_hash-2.0.3-cp26-none-macosx_10_11_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a357f0bfc43b14f8dfedfcbab9fe9fd7dc9de1cf0b49d72ada79042fe67fe577 |
|
MD5 | bf35f3212d94df8de21183cd04cd3bec |
|
BLAKE2b-256 | 7133e86d8075a19844ca05af7d318ca3c924fd95c6482648465d7fbaa8295acb |