24#define ROTL64(x, n) (((x) << (n)) | ((x) >> (64 - (n))))
27 (((apr_uint64_t)((p)[0]) ) | \
28 ((apr_uint64_t)((p)[1]) << 8) | \
29 ((apr_uint64_t)((p)[2]) << 16) | \
30 ((apr_uint64_t)((p)[3]) << 24) | \
31 ((apr_uint64_t)((p)[4]) << 32) | \
32 ((apr_uint64_t)((p)[5]) << 40) | \
33 ((apr_uint64_t)((p)[6]) << 48) | \
34 ((apr_uint64_t)((p)[7]) << 56))
36#define U64TO8_LE(p, v) \
38 (p)[0] = (unsigned char)((v) ); \
39 (p)[1] = (unsigned char)((v) >> 8); \
40 (p)[2] = (unsigned char)((v) >> 16); \
41 (p)[3] = (unsigned char)((v) >> 24); \
42 (p)[4] = (unsigned char)((v) >> 32); \
43 (p)[5] = (unsigned char)((v) >> 40); \
44 (p)[6] = (unsigned char)((v) >> 48); \
45 (p)[7] = (unsigned char)((v) >> 56); \
50 v0 += v1; v1=ROTL64(v1,13); v1 ^= v0; v0=ROTL64(v0,32); \
51 v2 += v3; v3=ROTL64(v3,16); v3 ^= v2; \
52 v0 += v3; v3=ROTL64(v3,21); v3 ^= v0; \
53 v2 += v1; v1=ROTL64(v1,17); v1 ^= v2; v2=ROTL64(v2,32); \
56#define SIPHASH(r, s, n, k) \
58 const unsigned char *ptr, *end; \
59 apr_uint64_t v0, v1, v2, v3, m; \
60 apr_uint64_t k0, k1; \
63 k0 = U8TO64_LE(k + 0); \
64 k1 = U8TO64_LE(k + 8); \
65 v3 = k1 ^ (apr_uint64_t)0x7465646279746573ULL; \
66 v2 = k0 ^ (apr_uint64_t)0x6c7967656e657261ULL; \
67 v1 = k1 ^ (apr_uint64_t)0x646f72616e646f6dULL; \
68 v0 = k0 ^ (apr_uint64_t)0x736f6d6570736575ULL; \
70 rem = (unsigned int)(n & 0x7); \
71 for (ptr = s, end = ptr + n - rem; ptr < end; ptr += 8) { \
77 m = (apr_uint64_t)(n & 0xff) << 56; \
79 case 7: m |= (apr_uint64_t)ptr[6] << 48; \
80 case 6: m |= (apr_uint64_t)ptr[5] << 40; \
81 case 5: m |= (apr_uint64_t)ptr[4] << 32; \
82 case 4: m |= (apr_uint64_t)ptr[3] << 24; \
83 case 3: m |= (apr_uint64_t)ptr[2] << 16; \
84 case 2: m |= (apr_uint64_t)ptr[1] << 8; \
85 case 1: m |= (apr_uint64_t)ptr[0]; \
95 r = v0 ^ v1 ^ v2 ^ v3; \
100 unsigned int c,
unsigned int d)
107 for (i = 0; i < c; ++i) { \
113 for (i = 0; i < d; ++i) { \
124 unsigned int c,
unsigned int d)
const char apr_size_t len
APU_DECLARE(void)
Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...
#define SIPHASH(r, s, n, k)
APR-UTIL siphash library "SipHash-c-d is a family of pseudorandom functions (a.k.a....
apr_size_t const unsigned char unsigned int unsigned int d
#define APR_SIPHASH_DSIZE
#define APR_SIPHASH_KSIZE
apr_vformatter_buff_t * c