require "test/unit" require File.join(File.dirname(__FILE__), "..", "lib", "fnv") class FnvTest < Test::Unit::TestCase def test_fnv1_32 { "" => 0x811c9dc5, "a" => 0x050c5d7e, "b" => 0x050c5d7d, "c" => 0x050c5d7c, "d" => 0x050c5d7b, "e" => 0x050c5d7a, "f" => 0x050c5d79, "fo" => 0x6b772514, "foo" => 0x408f5e13, "foob" => 0xb4b1178b, "fooba" => 0xfdc80fb0, "foobar" => 0x31f0b262, "ch" => 0x6e772a5c, "cho" => 0x4197aebb, "chon" => 0xfcc8100f, "chong" => 0xfdf147fa, "chongo" => 0xbcd44ee1, "chongo " => 0x23382c13, "chongo w" => 0x846d619e, "chongo wa" => 0x1630abdb, "chongo was" => 0xc99e89b2, "chongo was " => 0x1692c316, "chongo was h" => 0x9f091bca, "chongo was he" => 0x2556be9b, "chongo was her" => 0x628e0e73, "chongo was here" => 0x98a0bf6c, "chongo was here!" => 0xb10d5725, "chongo was here!\n" => 0xdd002f35, "cu" => 0x6e772a41, "cur" => 0x26978421, "curd" => 0xe184ff97, "curds" => 0x9b5e5ac6, "curds " => 0x5b88e592, "curds a" => 0xaa8164b7, "curds an" => 0x20b18c7b, "curds and" => 0xf28025c5, "curds and " => 0x84bb753f, "curds and w" => 0x3219925a, "curds and wh" => 0x384163c6, "curds and whe" => 0x54f010d7, "curds and whey" => 0x8cea820c, "curds and whey\n" => 0xe12ab8ee, "hi" => 0x6977223c, "hello" => 0xb6fa7167, "\xff\x00\x00\x01" => 0xb78320a1, "\x01\x00\x00\xff" => 0x0caf4135, "\xff\x00\x00\x02" => 0xb78320a2, "\x02\x00\x00\xff" => 0xcdc88e80, "\xff\x00\x00\x03" => 0xb78320a3, "\x03\x00\x00\xff" => 0x8ee1dbcb, "\xff\x00\x00\x04" => 0xb78320a4, "\x04\x00\x00\xff" => 0x4ffb2716, "\x40\x51\x4e\x44" => 0x860632aa, "\x44\x4e\x51\x40" => 0xcc2c5c64, "\x40\x51\x4e\x4a" => 0x860632a4, "\x4a\x4e\x51\x40" => 0x2a7ec4a6, "\x40\x51\x4e\x54" => 0x860632ba, "\x54\x4e\x51\x40" => 0xfefe8e14, "127.0.0.1" => 0x0a3cffd8, "127.0.0.2" => 0x0a3cffdb, "127.0.0.3" => 0x0a3cffda, "64.81.78.68" => 0xc07167d7, "64.81.78.74" => 0xbf716668, "64.81.78.84" => 0xc6717155, "feedface" => 0x7662e0d6, "feedfacedaffdeed" => 0xc2732f95, "feedfacedeadbeef" => 0x3a19c02a, "line 1\nline 2\nline 3" => 0x31ae8f83, "chongo /\\../\\" => 0x995fa9c4, "chongo (Landon Curt Noll) /\\../\\" => 0x5036a251, "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0xb4448d60, "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0x025dfe59, "http://epod.usra.edu/" => 0xc5eab3af, "http://exoplanet.eu/" => 0x7d21ba1e, "http://hvo.wr.usgs.gov/cam3/" => 0x7704cddb, "http://hvo.wr.usgs.gov/cams/HMcam/" => 0xd0071bfe, "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0x0ff3774c, "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0xb0fea0ea, "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0x58177303, "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x4f599cda, "http://neo.jpl.nasa.gov/risk/" => 0x3e590a47, "http://norvig.com/21-days.html" => 0x965595f8, "http://primes.utm.edu/curios/home.php" => 0xc37f178d, "http://slashdot.org/" => 0x9711dd26, "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0x23c99b7f, "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x6e568b17, "http://www.avo.alaska.edu/activity/Redoubt.php" => 0x43f0245b, "http://www.dilbert.com/fast/" => 0xbcb7a001, "http://www.fourmilab.ch/gravitation/orbits/" => 0x12e6dffe, "http://www.fpoa.net/" => 0x0792f2d6, "http://www.ioccc.org/index.html" => 0xb966936b, "http://www.isthe.com/cgi-bin/number.cgi" => 0x46439ac5, "http://www.isthe.com/chongo/bio.html" => 0x728d49af, "http://www.isthe.com/chongo/index.html" => 0xd33745c9, "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0xbc382a57, "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x4bda1d31, "http://www.isthe.com/chongo/tech/astro/vita.html" => 0xce35ccae, "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x3b6eed94, "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0x445c9c58, "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0x3db8bf9d, "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0x2dee116d, "http://www.isthe.com/chongo/tech/math/number/number.html" => 0xc18738da, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0x5b156176, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0x2aa7d593, "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0xb2409658, "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0xe1489528, "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0xfe1ee07e, "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0xe8842315, "http://www.lavarnd.org/index.html" => 0x3a6a63a2, "http://www.lavarnd.org/what/nist-test.html" => 0x06d2c18c, "http://www.macosxhints.com/" => 0xf8ef7225, "http://www.mellis.com/" => 0x843d3300, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0xbb24f7ae, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x878c0ec9, "http://www.paulnoll.com/" => 0xb557810f, "http://www.pepysdiary.com/" => 0x57423246, "http://www.sciencenews.org/index/home/activity/view" => 0x87f7505e, "http://www.skyandtelescope.com/" => 0xbb809f20, "http://www.sput.nl/~rob/sirius.html" => 0x8932abb5, "http://www.systemexperts.com/" => 0x0a9b3aa0, "http://www.tq-international.com/phpBB3/index.php" => 0xb8682a24, "http://www.travelquesttours.com/index.htm" => 0xa7ac1c56, "http://www.wunderground.com/global/stations/89606.html" => 0x11409252, "21701" * 10 => 0xa987f517, "M21701" * 10 => 0xf309e7ed, "2^21701-1" * 10 => 0xc9e8f417, "\x54\xc5" * 10 => 0x7f447bdd, "\xc5\x54" * 10 => 0xb929adc5, "23209" * 10 => 0x57022879, "M23209" * 10 => 0xdcfd2c49, "2^23209-1" * 10 => 0x6edafff5, "\x5a\xa9" * 10 => 0xf04fb1f1, "\xa9\x5a" * 10 => 0xfb7de8b9, "391581216093" * 10 => 0xc5f1d7e9, "391581*2^216093-1" * 10 => 0x32c1f439, "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0x7fd3eb7d, "FEDCBA9876543210" * 10 => 0x81597da5, "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0x05eb7a25, "EFCDAB8967452301" * 10 => 0x9c0fa1b5, "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0x53ccb1c5, "0123456789ABCDEF" * 10 => 0xfabece15, "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0x4ad745a5, "1032547698BADCFE" * 10 => 0xe5bdc495, "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0x23b3c0a5, "\x00" * 500 => 0xfa823dd5, "\x07" * 500 => 0x0c6c58b9, "~" * 500 => 0xe2dbccd5, "\x7f" * 500 => 0xdb7f50f9 }.each do |k, v| assert_equal v, FNV.new.fnv1_32(k) end end def test_fnv1a_32 { "" => 0x811c9dc5, "a" => 0xe40c292c, "b" => 0xe70c2de5, "c" => 0xe60c2c52, "d" => 0xe10c2473, "e" => 0xe00c22e0, "f" => 0xe30c2799, "fo" => 0x6222e842, "foo" => 0xa9f37ed7, "foob" => 0x3f5076ef, "fooba" => 0x39aaa18a, "foobar" => 0xbf9cf968, "ch" => 0x5f299f4e, "cho" => 0xef8580f3, "chon" => 0xac297727, "chong" => 0x4546b9c0, "chongo" => 0xbd564e7d, "chongo " => 0x6bdd5c67, "chongo w" => 0xdd77ed30, "chongo wa" => 0xf4ca9683, "chongo was" => 0x4aeb9bd0, "chongo was " => 0xe0e67ad0, "chongo was h" => 0xc2d32fa8, "chongo was he" => 0x7f743fb7, "chongo was her" => 0x6900631f, "chongo was here" => 0xc59c990e, "chongo was here!" => 0x448524fd, "chongo was here!\n" => 0xd49930d5, "cu" => 0x4c298165, "cur" => 0xfc563735, "curd" => 0x8cb91483, "curds" => 0x775bf5d0, "curds " => 0xd5c428d0, "curds a" => 0x34cc0ea3, "curds an" => 0xea3b4cb7, "curds and" => 0x8e59f029, "curds and " => 0x2094de2b, "curds and w" => 0xa65a0ad4, "curds and wh" => 0x9bbee5f4, "curds and whe" => 0xbe836343, "curds and whey" => 0x22d5344e, "curds and whey\n" => 0x19a1470c, "hi" => 0x683af69a, "hello" => 0x4f9f2cab, "\xff\x00\x00\x01" => 0xc48fb86d, "\x01\x00\x00\xff" => 0x2269f369, "\xff\x00\x00\x02" => 0xc18fb3b4, "\x02\x00\x00\xff" => 0x50ef1236, "\xff\x00\x00\x03" => 0xc28fb547, "\x03\x00\x00\xff" => 0x96c3bf47, "\xff\x00\x00\x04" => 0xbf8fb08e, "\x04\x00\x00\xff" => 0xf3e4d49c, "\x40\x51\x4e\x44" => 0x32179058, "\x44\x4e\x51\x40" => 0x280bfee6, "\x40\x51\x4e\x4a" => 0x30178d32, "\x4a\x4e\x51\x40" => 0x21addaf8, "\x40\x51\x4e\x54" => 0x4217a988, "\x54\x4e\x51\x40" => 0x772633d6, "127.0.0.1" => 0x08a3d11e, "127.0.0.2" => 0x07a3cf8b, "127.0.0.3" => 0x06a3cdf8, "64.81.78.68" => 0x1d5636a7, "64.81.78.74" => 0x1353e852, "64.81.78.84" => 0xa55b89ed, "feedface" => 0x0588b13c, "feedfacedaffdeed" => 0xe83641e1, "feedfacedeadbeef" => 0xf1760448, "line 1\nline 2\nline 3" => 0x97b4ea23, "chongo /\\../\\" => 0x9a4e92e6, "chongo (Landon Curt Noll) /\\../\\" => 0xf01b2511, "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0xce524afa, "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0xdd16ef45, "http://epod.usra.edu/" => 0x60648bb3, "http://exoplanet.eu/" => 0x7fa4bcfc, "http://hvo.wr.usgs.gov/cam3/" => 0x5053ae17, "http://hvo.wr.usgs.gov/cams/HMcam/" => 0xc9302890, "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0x956ded32, "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0x9136db84, "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0xdf9d3323, "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x32bb6cd0, "http://neo.jpl.nasa.gov/risk/" => 0xc8f8385b, "http://norvig.com/21-days.html" => 0xeb08bfba, "http://primes.utm.edu/curios/home.php" => 0x62cc8e3d, "http://slashdot.org/" => 0xc3e20f5c, "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0x39e97f17, "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x7837b203, "http://www.avo.alaska.edu/activity/Redoubt.php" => 0x319e877b, "http://www.dilbert.com/fast/" => 0xd3e63f89, "http://www.fourmilab.ch/gravitation/orbits/" => 0x29b50b38, "http://www.fpoa.net/" => 0x5ed678b8, "http://www.ioccc.org/index.html" => 0xb0d5b793, "http://www.isthe.com/cgi-bin/number.cgi" => 0x52450be5, "http://www.isthe.com/chongo/bio.html" => 0xfa72d767, "http://www.isthe.com/chongo/index.html" => 0x95066709, "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0x7f52e123, "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x76966481, "http://www.isthe.com/chongo/tech/astro/vita.html" => 0x063258b0, "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x2ded6e8a, "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0xb07d7c52, "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0xd0c71b71, "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0xf684f1bd, "http://www.isthe.com/chongo/tech/math/number/number.html" => 0x868ecfa8, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0xf794f684, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0xd19701c3, "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0x346e171e, "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0x91f8f676, "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0x0bf58848, "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0x6317b6d1, "http://www.lavarnd.org/index.html" => 0xafad4c54, "http://www.lavarnd.org/what/nist-test.html" => 0x0f25681e, "http://www.macosxhints.com/" => 0x91b18d49, "http://www.mellis.com/" => 0x7d61c12e, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0x5147d25c, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x9a8b6805, "http://www.paulnoll.com/" => 0x4cd2a447, "http://www.pepysdiary.com/" => 0x1e549b14, "http://www.sciencenews.org/index/home/activity/view" => 0x2fe1b574, "http://www.skyandtelescope.com/" => 0xcf0cd31e, "http://www.sput.nl/~rob/sirius.html" => 0x6c471669, "http://www.systemexperts.com/" => 0x0e5eef1e, "http://www.tq-international.com/phpBB3/index.php" => 0x2bed3602, "http://www.travelquesttours.com/index.htm" => 0xb26249e0, "http://www.wunderground.com/global/stations/89606.html" => 0x2c9b86a4, "21701" * 10 => 0xe415e2bb, "M21701" * 10 => 0x18a98d1d, "2^21701-1" * 10 => 0xb7df8b7b, "\x54\xc5" * 10 => 0x241e9075, "\xc5\x54" * 10 => 0x063f70dd, "23209" * 10 => 0x0295aed9, "M23209" * 10 => 0x56a7f781, "2^23209-1" * 10 => 0x253bc645, "\x5a\xa9" * 10 => 0x46610921, "\xa9\x5a" * 10 => 0x7c1577f9, "391581216093" * 10 => 0x512b2851, "391581*2^216093-1" * 10 => 0x76823999, "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0xc0586935, "FEDCBA9876543210" * 10 => 0xf3415c85, "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0x0ae4ff65, "EFCDAB8967452301" * 10 => 0x58b79725, "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0xdea43aa5, "0123456789ABCDEF" * 10 => 0x2bb3be35, "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0xea777a45, "1032547698BADCFE" * 10 => 0x8f21c305, "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0x5c9d0865, "\x00" * 500 => 0xfa823dd5, "\x07" * 500 => 0x21a27271, "~" * 500 => 0x83c5c6d5, "\x7f" * 500 => 0x813b0881 }.each do |k, v| assert_equal v, FNV.new.fnv1a_32(k) end end def test_fnv1_64 { "" => 0xcbf29ce484222325, "a" => 0xaf63bd4c8601b7be, "b" => 0xaf63bd4c8601b7bd, "c" => 0xaf63bd4c8601b7bc, "d" => 0xaf63bd4c8601b7bb, "e" => 0xaf63bd4c8601b7ba, "f" => 0xaf63bd4c8601b7b9, "fo" => 0x08326207b4eb2f34, "foo" => 0xd8cbc7186ba13533, "foob" => 0x0378817ee2ed65cb, "fooba" => 0xd329d59b9963f790, "foobar" => 0x340d8765a4dda9c2, "ch" => 0x08326507b4eb341c, "cho" => 0xd8d5c8186ba98bfb, "chon" => 0x1ccefc7ef118dbef, "chong" => 0x0c92fab3ad3db77a, "chongo" => 0x9b77794f5fdec421, "chongo " => 0x0ac742dfe7874433, "chongo w" => 0xd7dad5766ad8e2de, "chongo wa" => 0xa1bb96378e897f5b, "chongo was" => 0x5b3f9b6733a367d2, "chongo was " => 0xb07ce25cbea969f6, "chongo was h" => 0x8d9e9997f9df0d6a, "chongo was he" => 0x838c673d9603cb7b, "chongo was her" => 0x8b5ee8a5e872c273, "chongo was here" => 0x4507c4e9fb00690c, "chongo was here!" => 0x4c9ca59581b27f45, "chongo was here!\n" => 0xe0aca20b624e4235, "cu" => 0x08326507b4eb3401, "cur" => 0xd8d5ad186ba95dc1, "curd" => 0x1c72e17ef0ca4e97, "curds" => 0x2183c1b327c38ae6, "curds " => 0xb66d096c914504f2, "curds a" => 0x404bf57ad8476757, "curds an" => 0x887976bd815498bb, "curds and" => 0x3afd7f02c2bf85a5, "curds and " => 0xfc4476b0eb70177f, "curds and w" => 0x186d2da00f77ecba, "curds and wh" => 0xf97140fa48c74066, "curds and whe" => 0xa2b1cf49aa926d37, "curds and whey" => 0x0690712cd6cf940c, "curds and whey\n" => 0xf7045b3102b8906e, "hi" => 0x08326007b4eb2b9c, "hello" => 0x7b495389bdbdd4c7, "\xff\x00\x00\x01" => 0xd6b2b17bf4b71261, "\x01\x00\x00\xff" => 0x447bfb7f98e615b5, "\xff\x00\x00\x02" => 0xd6b2b17bf4b71262, "\x02\x00\x00\xff" => 0x3bd2807f93fe1660, "\xff\x00\x00\x03" => 0xd6b2b17bf4b71263, "\x03\x00\x00\xff" => 0x3329057f8f16170b, "\xff\x00\x00\x04" => 0xd6b2b17bf4b71264, "\x04\x00\x00\xff" => 0x2a7f8a7f8a2e19b6, "\x40\x51\x4e\x44" => 0x23d3767e64b2f98a, "\x44\x4e\x51\x40" => 0xff768d7e4f9d86a4, "\x40\x51\x4e\x4a" => 0x23d3767e64b2f984, "\x4a\x4e\x51\x40" => 0xccd1837e334e4aa6, "\x40\x51\x4e\x54" => 0x23d3767e64b2f99a, "\x54\x4e\x51\x40" => 0x7691fd7e028f6754, "127.0.0.1" => 0x34ad3b1041204318, "127.0.0.2" => 0x34ad3b104120431b, "127.0.0.3" => 0x34ad3b104120431a, "64.81.78.68" => 0x02a17ebca4aa3497, "64.81.78.74" => 0x02a17dbca4aa32c8, "64.81.78.84" => 0x02a184bca4aa3ed5, "feedface" => 0x5c2c346706186f36, "feedfacedaffdeed" => 0xed9478212b267395, "feedfacedeadbeef" => 0x8c54f0203249438a, "line 1\nline 2\nline 3" => 0xa64e5f36c9e2b0e3, "chongo /\\../\\" => 0x8fd0680da3088a04, "chongo (Landon Curt Noll) /\\../\\" => 0xb37d55d81c57b331, "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0xcb27f4b8e1b6cc20, "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0x26caf88bcbef2d19, "http://epod.usra.edu/" => 0x8e6e063b97e61b8f, "http://exoplanet.eu/" => 0xb42750f7f3b7c37e, "http://hvo.wr.usgs.gov/cam3/" => 0xf3c6ba64cf7ca99b, "http://hvo.wr.usgs.gov/cams/HMcam/" => 0xebfb69b427ea80fe, "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0x39b50c3ed970f46c, "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0x5b9b177aa3eb3e8a, "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0x6510063ecf4ec903, "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x2b3bbd2c00797c7a, "http://neo.jpl.nasa.gov/risk/" => 0xf1d6204ff5cb4aa7, "http://norvig.com/21-days.html" => 0x4836e27ccf099f38, "http://primes.utm.edu/curios/home.php" => 0x82efbb0dd073b44d, "http://slashdot.org/" => 0x4a80c282ffd7d4c6, "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0x305d1a9c9ee43bdf, "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x15c366948ffc6997, "http://www.avo.alaska.edu/activity/Redoubt.php" => 0x80153ae218916e7b, "http://www.dilbert.com/fast/" => 0xfa23e2bdf9e2a9e1, "http://www.fourmilab.ch/gravitation/orbits/" => 0xd47e8d8a2333c6de, "http://www.fpoa.net/" => 0x7e128095f688b056, "http://www.ioccc.org/index.html" => 0x2f5356890efcedab, "http://www.isthe.com/cgi-bin/number.cgi" => 0x95c2b383014f55c5, "http://www.isthe.com/chongo/bio.html" => 0x4727a5339ce6070f, "http://www.isthe.com/chongo/index.html" => 0xb0555ecd575108e9, "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0x48d785770bb4af37, "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x09d4701c12af02b1, "http://www.isthe.com/chongo/tech/astro/vita.html" => 0x79f031e78f3cf62e, "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x52a1ee85db1b5a94, "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0x6bd95b2eb37fa6b8, "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0x74971b7077aef85d, "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0xb4e4fae2ffcc1aad, "http://www.isthe.com/chongo/tech/math/number/number.html" => 0x2bd48bd898b8f63a, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0xe9966ac1556257f6, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0x92a3d1cd078ba293, "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0xf81175a482e20ab8, "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0x5bbb3de722e73048, "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0x6b4f363492b9f2be, "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0xc2d559df73d59875, "http://www.lavarnd.org/index.html" => 0xf75f62284bc7a8c2, "http://www.lavarnd.org/what/nist-test.html" => 0xda8dd8e116a9f1cc, "http://www.macosxhints.com/" => 0xbdc1e6ab76057885, "http://www.mellis.com/" => 0xfec6a4238a1224a0, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0xc03f40f3223e290e, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x1ed21673466ffda9, "http://www.paulnoll.com/" => 0xdf70f906bb0dd2af, "http://www.pepysdiary.com/" => 0xf3dcda369f2af666, "http://www.sciencenews.org/index/home/activity/view" => 0x9ebb11573cdcebde, "http://www.skyandtelescope.com/" => 0x81c72d9077fedca0, "http://www.sput.nl/~rob/sirius.html" => 0x0ec074a31be5fb15, "http://www.systemexperts.com/" => 0x2a8b3280b6c48f20, "http://www.tq-international.com/phpBB3/index.php" => 0xfd31777513309344, "http://www.travelquesttours.com/index.htm" => 0x194534a86ad006b6, "http://www.wunderground.com/global/stations/89606.html" => 0x3be6fdf46e0cfe12, "21701" * 10 => 0x017cc137a07eb057, "M21701" * 10 => 0x9428fc6e7d26b54d, "2^21701-1" * 10 => 0x9aaa2e3603ef8ad7, "\x54\xc5" * 10 => 0x82c6d3f3a0ccdf7d, "\xc5\x54" * 10 => 0xc86eeea00cf09b65, "23209" * 10 => 0x705f8189dbb58299, "M23209" * 10 => 0x415a7f554391ca69, "2^23209-1" * 10 => 0xcfe3d49fa2bdc555, "\x5a\xa9" * 10 => 0xf0f9c56039b25191, "\xa9\x5a" * 10 => 0x7075cb6abd1d32d9, "391581216093" * 10 => 0x43c94e2c8b277509, "391581*2^216093-1" * 10 => 0x3cbfd4e4ea670359, "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0xc05887810f4d019d, "FEDCBA9876543210" * 10 => 0x14468ff93ac22dc5, "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0xebed699589d99c05, "EFCDAB8967452301" * 10 => 0x6d99f6df321ca5d5, "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0x0cd410d08c36d625, "0123456789ABCDEF" * 10 => 0xef1b2a2c86831d35, "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0x3b349c4d69ee5f05, "1032547698BADCFE" * 10 => 0x55248ce88f45f035, "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0xaa69ca6a18a4c885, "\x00" * 500 => 0x1fe3fce62bd816b5, "\x07" * 500 => 0x0289a488a8df69d9, "~" * 500 => 0x15e96e1613df98b5, "\x7f" * 500 => 0xe6be57375ad89b99 }.each do |k, v| assert_equal v, FNV.new.fnv1_64(k) end end def test_fnv1a_64 { "" => 0xcbf29ce484222325, "a" => 0xaf63dc4c8601ec8c, "b" => 0xaf63df4c8601f1a5, "c" => 0xaf63de4c8601eff2, "d" => 0xaf63d94c8601e773, "e" => 0xaf63d84c8601e5c0, "f" => 0xaf63db4c8601ead9, "fo" => 0x08985907b541d342, "foo" => 0xdcb27518fed9d577, "foob" => 0xdd120e790c2512af, "fooba" => 0xcac165afa2fef40a, "foobar" => 0x85944171f73967e8, "ch" => 0x08a25607b54a22ae, "cho" => 0xf5faf0190cf90df3, "chon" => 0xf27397910b3221c7, "chong" => 0x2c8c2b76062f22e0, "chongo" => 0xe150688c8217b8fd, "chongo " => 0xf35a83c10e4f1f87, "chongo w" => 0xd1edd10b507344d0, "chongo wa" => 0x2a5ee739b3ddb8c3, "chongo was" => 0xdcfb970ca1c0d310, "chongo was " => 0x4054da76daa6da90, "chongo was h" => 0xf70a2ff589861368, "chongo was he" => 0x4c628b38aed25f17, "chongo was her" => 0x9dd1f6510f78189f, "chongo was here" => 0xa3de85bd491270ce, "chongo was here!" => 0x858e2fa32a55e61d, "chongo was here!\n" => 0x46810940eff5f915, "cu" => 0x08a24307b54a0265, "cur" => 0xf5b9fd190cc18d15, "curd" => 0x4c968290ace35703, "curds" => 0x07174bd5c64d9350, "curds " => 0x5a294c3ff5d18750, "curds a" => 0x05b3c1aeb308b843, "curds an" => 0xb92a48da37d0f477, "curds and" => 0x73cdddccd80ebc49, "curds and " => 0xd58c4c13210a266b, "curds and w" => 0xe78b6081243ec194, "curds and wh" => 0xb096f77096a39f34, "curds and whe" => 0xb425c54ff807b6a3, "curds and whey" => 0x23e520e2751bb46e, "curds and whey\n" => 0x1a0b44ccfe1385ec, "hi" => 0x08ba5f07b55ec3da, "hello" => 0xa430d84680aabd0b, "\xff\x00\x00\x01" => 0x6961196491cc682d, "\x01\x00\x00\xff" => 0xad2bb1774799dfe9, "\xff\x00\x00\x02" => 0x6961166491cc6314, "\x02\x00\x00\xff" => 0x8d1bb3904a3b1236, "\xff\x00\x00\x03" => 0x6961176491cc64c7, "\x03\x00\x00\xff" => 0xed205d87f40434c7, "\xff\x00\x00\x04" => 0x6961146491cc5fae, "\x04\x00\x00\xff" => 0xcd3baf5e44f8ad9c, "\x40\x51\x4e\x44" => 0xe3b36596127cd6d8, "\x44\x4e\x51\x40" => 0xf77f1072c8e8a646, "\x40\x51\x4e\x4a" => 0xe3b36396127cd372, "\x4a\x4e\x51\x40" => 0x6067dce9932ad458, "\x40\x51\x4e\x54" => 0xe3b37596127cf208, "\x54\x4e\x51\x40" => 0x4b7b10fa9fe83936, "127.0.0.1" => 0xaabafe7104d914be, "127.0.0.2" => 0xaabafd7104d9130b, "127.0.0.3" => 0xaabafc7104d91158, "64.81.78.68" => 0xe729bac5d2a8d3a7, "64.81.78.74" => 0xe72630c5d2a5b352, "64.81.78.84" => 0xe73042c5d2ae266d, "feedface" => 0x0a83c86fee952abc, "feedfacedaffdeed" => 0x3e66d3d56b8caca1, "feedfacedeadbeef" => 0xcac54572bb1a6fc8, "line 1\nline 2\nline 3" => 0x7829851fac17b143, "chongo /\\../\\" => 0x2c8f4c9af81bcf06, "chongo (Landon Curt Noll) /\\../\\" => 0x3605a2ac253d2db1, "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0x6be396289ce8a6da, "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0xd9b957fb7fe794c5, "http://epod.usra.edu/" => 0x05be33da04560a93, "http://exoplanet.eu/" => 0x0957f1577ba9747c, "http://hvo.wr.usgs.gov/cam3/" => 0xda2cc3acc24fba57, "http://hvo.wr.usgs.gov/cams/HMcam/" => 0x74136f185b29e7f0, "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0xb2f2b4590edb93b2, "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0xb3608fce8b86ae04, "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0x4a3a865079359063, "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x5b3a7ef496880a50, "http://neo.jpl.nasa.gov/risk/" => 0x48fae3163854c23b, "http://norvig.com/21-days.html" => 0x07aaa640476e0b9a, "http://primes.utm.edu/curios/home.php" => 0x2f653656383a687d, "http://slashdot.org/" => 0xa1031f8e7599d79c, "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0xa31908178ff92477, "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x097edf3c14c3fb83, "http://www.avo.alaska.edu/activity/Redoubt.php" => 0xb51ca83feaa0971b, "http://www.dilbert.com/fast/" => 0xdd3c0d96d784f2e9, "http://www.fourmilab.ch/gravitation/orbits/" => 0x86cd26a9ea767d78, "http://www.fpoa.net/" => 0xe6b215ff54a30c18, "http://www.ioccc.org/index.html" => 0xec5b06a1c5531093, "http://www.isthe.com/cgi-bin/number.cgi" => 0x45665a929f9ec5e5, "http://www.isthe.com/chongo/bio.html" => 0x8c7609b4a9f10907, "http://www.isthe.com/chongo/index.html" => 0x89aac3a491f0d729, "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0x32ce6b26e0f4a403, "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x614ab44e02b53e01, "http://www.isthe.com/chongo/tech/astro/vita.html" => 0xfa6472eb6eef3290, "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x9e5d75eb1948eb6a, "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0xb6d12ad4a8671852, "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0x88826f56eba07af1, "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0x44535bf2645bc0fd, "http://www.isthe.com/chongo/tech/math/number/number.html" => 0x169388ffc21e3728, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0xf68aac9e396d8224, "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0x8e87d7e7472b3883, "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0x295c26caa8b423de, "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0x322c814292e72176, "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0x8a06550eb8af7268, "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0xef86d60e661bcf71, "http://www.lavarnd.org/index.html" => 0x9e5426c87f30ee54, "http://www.lavarnd.org/what/nist-test.html" => 0xf1ea8aa826fd047e, "http://www.macosxhints.com/" => 0x0babaf9a642cb769, "http://www.mellis.com/" => 0x4b3341d4068d012e, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0xd15605cbc30a335c, "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x5b21060aed8412e5, "http://www.paulnoll.com/" => 0x45e2cda1ce6f4227, "http://www.pepysdiary.com/" => 0x50ae3745033ad7d4, "http://www.sciencenews.org/index/home/activity/view" => 0xaa4588ced46bf414, "http://www.skyandtelescope.com/" => 0xc1b0056c4a95467e, "http://www.sput.nl/~rob/sirius.html" => 0x56576a71de8b4089, "http://www.systemexperts.com/" => 0xbf20965fa6dc927e, "http://www.tq-international.com/phpBB3/index.php" => 0x569f8383c2040882, "http://www.travelquesttours.com/index.htm" => 0xe1e772fba08feca0, "http://www.wunderground.com/global/stations/89606.html" => 0x4ced94af97138ac4, "21701" * 10 => 0xc4112ffb337a82fb, "M21701" * 10 => 0xd64a4fd41de38b7d, "2^21701-1" * 10 => 0x4cfc32329edebcbb, "\x54\xc5" * 10 => 0x0803564445050395, "\xc5\x54" * 10 => 0xaa1574ecf4642ffd, "23209" * 10 => 0x694bc4e54cc315f9, "M23209" * 10 => 0xa3d7cb273b011721, "2^23209-1" * 10 => 0x577c2f8b6115bfa5, "\x5a\xa9" * 10 => 0xb7ec8c1a769fb4c1, "\xa9\x5a" * 10 => 0x5d5cfce63359ab19, "391581216093" * 10 => 0x33b96c3cd65b5f71, "391581*2^216093-1" * 10 => 0xd845097780602bb9, "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0x84d47645d02da3d5, "FEDCBA9876543210" * 10 => 0x83544f33b58773a5, "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0x9175cbb2160836c5, "EFCDAB8967452301" * 10 => 0xc71b3bc175e72bc5, "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0x636806ac222ec985, "0123456789ABCDEF" * 10 => 0xb6ef0e6950f52ed5, "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0xead3d8a0f3dfdaa5, "1032547698BADCFE" * 10 => 0x922908fe9a861ba5, "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0x6d4821de275fd5c5, "\x00" * 500 => 0x1fe3fce62bd816b5, "\x07" * 500 => 0xc23e9fccd6f70591, "~" * 500 => 0xc1af12bdfe16b5b5, "\x7f" * 500 => 0x39e9f18f2f85e221 }.each do |k, v| assert_equal v, FNV.new.fnv1a_64(k) end end end