Ketama hash implemented by c++