3 unsigned int rbtdb_djb2(TDB_DATA
*data
)
5 unsigned char *key
= data
->dptr
;
6 size_t len
= data
->dsize
;
7 unsigned int hash
= 5381;
10 for (i
= 0; i
< len
; ++i
)
11 hash
= ((hash
<< 5) + hash
) + key
[i
]; /* (hash*33) + key[i] */
15 unsigned int rbtdb_djb3(TDB_DATA
*data
)
17 unsigned char *key
= data
->dptr
;
18 size_t len
= data
->dsize
;
19 unsigned int hash
= 5381;
22 for (i
= 0; i
< len
; ++i
)
23 hash
= ((hash
<< 5) + hash
) ^ key
[i
]; /* (hash*33) ^ key[i] */