blob: 6c328704ae447fbfe007b6312f0b1d7b53d7476b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* crypto, cipher and obfuscation related functions
*/
#include "crypto.h"
/* a very simple homemade hash function with no strong properties at all.
*/
unsigned int
mhash (unsigned char *src, unsigned int len)
{
unsigned int hash = len; /* some small initial gain */
for (hash = 0 ; len > 0 ; --len, ++src) {
hash ^= *src;
hash = ((hash & 0xffe00000) >> 21) |
((hash & 0x001fffff) << 11);
hash += *src;
hash += len;
}
return (hash);
}
|