10 if ($y & 1) { $a ^= $x };
11 if ($x & 0x80000000) { $x <<= 1; $x ^= $MOD; }
21 for (my $i = 0; $i < length $msg; $i++) {
22 my $m = ord(substr($msg, $i, 1));
23 $h = gfmul
($h ^ $m, $k);
25 printf " 0x%08x \"%s\" 0x%08x;\n", $k, $msg, $h;
29 # test vectors for unihash
33 hash
(0x00000000, "anything you like");
34 hash
(0x12345678, "an exaple test string");
35 hash
(0xb8a171f0, "The quick brown fox jumps over the lazy dog.");
36 hash
(0x2940521b, "A man, a plan, a canal: Panama!");
40 for (my $i = 0; $i < 48; $i++) {
41 hash
($k, "If we don't succeed, we run the risk of failure.");