implements consistent hashing