13 lines
253 B
C
Raw Normal View History

2018-09-02 14:23:37 +01:00
#include "hash.h"
uint32_t rcheevos_djb2(const char* str, size_t length)
2018-09-02 14:23:37 +01:00
{
const unsigned char* aux = (const unsigned char*)str;
uint32_t hash = 5381;
while (length--)
hash = ( hash << 5 ) + hash + *aux++;
return hash;
}