class String
Public Instance Methods
consistent_hash()
click to toggle source
VALUE consistent_hash(VALUE string) { uint32_t h = 0; for (int i = 0; i < RSTRING_LEN(string); i++) { uint32_t c = RSTRING_PTR(string)[i]; h = h * 31 + c; } return INT2NUM(h); }