31# define RABINKARP_SEED 1
38# define RABINKARP_MULT 0x08104225U
44# define RABINKARP_INVM 0x98f009adU
50# define RABINKARP_ADJ 0x08104224U
53typedef struct _rabinkarp {
59static inline void rabinkarp_init(rabinkarp_t *sum)
62 sum->hash = RABINKARP_SEED;
66void rabinkarp_update(rabinkarp_t *sum,
const unsigned char *buf,
size_t len);
68static inline void rabinkarp_rotate(rabinkarp_t *sum,
unsigned char out,
72 sum->hash * RABINKARP_MULT + in - sum->mult * (out + RABINKARP_ADJ);
75static inline void rabinkarp_rollin(rabinkarp_t *sum,
unsigned char in)
77 sum->hash = sum->hash * RABINKARP_MULT + in;
79 sum->mult *= RABINKARP_MULT;
82static inline void rabinkarp_rollout(rabinkarp_t *sum,
unsigned char out)
85 sum->mult *= RABINKARP_INVM;
86 sum->hash -= sum->mult * (out + RABINKARP_ADJ);
89static inline uint32_t rabinkarp_digest(rabinkarp_t *sum)