I am trying to implement a consistent hash based algorithm in java using the following reference for sharding keys to redis -
I am trying to understand the best way to generate the hascode for a node and a key. Currently I am using the DigestUtils to generate the hash as follows & adding the returned value to the ring/circle -
private BigInteger hash(String key) {
return new BigInteger(DigestUtils.md5Hex(key.getBytes()), 16);
}
I wanted to know if this approach sounds correct.