15 #define DELTA 0x9E3779B9
20 __u32 b0 = buf[0], b1 = buf[1];
21 __u32 a = in[0],
b = in[1],
c = in[2],
d = in[3];
26 b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);
27 b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);
36 static __u32 dx_hack_hash_unsigned(
const char *
name,
int len)
38 __u32 hash, hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
39 const unsigned char *ucp = (
const unsigned char *) name;
42 hash = hash1 + (hash0 ^ (((
int) *ucp++) * 7152373));
44 if (hash & 0x80000000)
52 static __u32 dx_hack_hash_signed(
const char *
name,
int len)
54 __u32 hash, hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
55 const signed char *
scp = (
const signed char *) name;
58 hash = hash1 + (hash0 ^ (((
int) *scp++) * 7152373));
60 if (hash & 0x80000000)
68 static void str2hashbuf_signed(
const char *
msg,
int len,
__u32 *
buf,
int num)
72 const signed char *
scp = (
const signed char *) msg;
80 for (i = 0; i < len; i++) {
83 val = ((
int) scp[i]) + (val << 8);
96 static void str2hashbuf_unsigned(
const char *msg,
int len,
__u32 *buf,
int num)
100 const unsigned char *ucp = (
const unsigned char *) msg;
108 for (i=0; i < len; i++) {
111 val = ((
int) ucp[i]) + (val << 8);
140 __u32 minor_hash = 0;
155 for (i=0; i < 4; i++) {
165 hash = dx_hack_hash_unsigned(name, len);
168 hash = dx_hack_hash_signed(name, len);
171 str2hashbuf = str2hashbuf_unsigned;
175 (*str2hashbuf)(
p, len,
in, 8);
184 str2hashbuf = str2hashbuf_unsigned;
188 (*str2hashbuf)(
p, len,
in, 4);
189 TEA_transform(buf, in);