4 ### Generate test vectors for universal hashing.
7 if SYS.version_info >= (3,): xrange = range
15 if x & 0x80000000: x = (x << 1) ^ MOD
22 for ch in m: h = gfmul(h ^ ord(ch), k)
23 print(' 0x%08x "%s" 0x%08x;' % (k, m, h))
26 ### Test vectors for universal hashing
31 for k, m in [(0x00000000, 'anything you like'),
32 (0x12345678, 'an exaple test string'),
33 (0xb8a171f0, 'The quick brown fox jumps over the lazy dog.'),
34 (0x2940521b, 'A man, a plan, a canal: Panama!')]:
37 k, m = 0x94b22a73, 0xbb7b1fef
39 hashtest(k, "If we don't succeed, we run the risk of failure.")