11 #ifndef TLX_STRING_HASH_SDBM_HEADER 12 #define TLX_STRING_HASH_SDBM_HEADER 29 while ((c = *str++) != 0) {
30 hash = c + (hash << 6) + (hash << 16) - hash;
41 return hash_sdbm(reinterpret_cast<const unsigned char*>(str));
49 uint32_t
hash_sdbm(
const unsigned char* str,
size_t size) {
52 hash =
static_cast<unsigned char>(*str++)
53 + (hash << 6) + (hash << 16) - hash;
64 return hash_sdbm(reinterpret_cast<const unsigned char*>(str), size);
80 #endif // !TLX_STRING_HASH_SDBM_HEADER
static uint32_t hash_sdbm(const unsigned char *str)
Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html.