ch-md5-masked-to-32-bits

Status: IN

The consistent hash ring's `_hash` function truncates MD5's 128-bit output to 32 bits via `& 0xFFFFFFFF`, matching the `RING_SIZE` of 2^32

Source: entries/2026/05/29/consistent-hashing-consistent_hashing.md

Example

def _hash(key):
    return int(hashlib.md5(key.encode()).hexdigest(), 16) & 0xFFFFFFFF

JSON