nvflare.fuel.utils.hash_utils module
- class UniformHash(num_buckets: int)[source]
Bases:
objectA hash algorithm with uniform distribution. It achieves this with following steps, 1. Get a hash value of the key using first 8 bytes of SHA256 2. Map the hash value to a virtual hash table using modulo operation 3. Map the virtual bucket to real bucket by even distribution
The virtual hash is needed because real hash table size may not be a prime number and there are known issues of modulo operation.
Initialize the hash function :param num_buckets: Number of buckets, e.g. Number of servers to distribute the load