11 #ifndef TLX_STRING_HASH_DJB2_HEADER 12 #define TLX_STRING_HASH_DJB2_HEADER 29 while ((c = *str++) != 0) {
31 hash = ((hash << 5) + hash) + c;
42 return hash_djb2(reinterpret_cast<const unsigned char*>(str));
50 uint32_t
hash_djb2(
const unsigned char* str,
size_t size) {
54 hash = ((hash << 5) + hash) + static_cast<unsigned char>(*str++);
65 return hash_djb2(reinterpret_cast<const unsigned char*>(str), size);
81 #endif // !TLX_STRING_HASH_DJB2_HEADER static uint32_t hash_djb2(const unsigned char *str)
Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html.