watercoldyi
6/8/2018 - 7:31 AM

lua hash

lua hash

unsigned int lhash (const char *str, unsigned int l, unsigned int seed) {
  unsigned int h = seed ^ l;
  unsigned int step = (l >> 5) + 1;
  for (; l >= step; l -= step)
    h ^= ((h<<5) + (h>>2) + (char)(str[l - 1]));
  return h;
}