consistent hash borrowed from groupcache