4 ### Generate test vectors for universal hashing.
12 if x
& 0x80000000: x
= (x
<< 1) ^ MOD
19 for ch
in m
: h
= gfmul(h ^
ord(ch
), k
)
20 print ' 0x%08x "%s" 0x%08x;' %
(k
, m
, h
)
23 ### Test vectors for universal hashing
28 for k
, m
in [(0x00000000, 'anything you like'),
29 (0x12345678, 'an exaple test string'),
30 (0xb8a171f0, 'The quick brown fox jumps over the lazy dog.'),
31 (0x2940521b, 'A man, a plan, a canal: Panama!')]:
34 k
, m
= 0x94b22a73, 0xbb7b1fef
36 hashtest(k
, "If we don't succeed, we run the risk of failure.")