1 #include "mltypes.h"
2 
3 /** bernstein hash, from public domain source */
4 
inv_checksum(unsigned char * str,int len)5 uint32_t inv_checksum(unsigned char *str, int len)
6 {
7     uint32_t hash = 5381;
8     int i, c;
9 
10     for (i = 0; i < len; i++) {
11         c = *(str + i);
12         hash = ((hash << 5) + hash) + c;    /* hash * 33 + c */
13     }
14 
15     return hash;
16 }
17