fnv 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (10) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +15 -0
  3. data/LICENSE +20 -0
  4. data/README.md +16 -0
  5. data/Rakefile +29 -0
  6. data/VERSION +1 -0
  7. data/lib/fnv.rb +52 -0
  8. data/test/fnv_test.rb +624 -0
  9. data/test_fnv.c +2237 -0
  10. metadata +107 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ group :development do
2
+ gem "bundler", "~> 1.0.0"
3
+ gem "jeweler", "~> 1.6.4"
4
+ end
@@ -0,0 +1,15 @@
1
+ GEM
2
+ specs:
3
+ git (1.2.5)
4
+ jeweler (1.6.4)
5
+ bundler (~> 1.0)
6
+ git (>= 1.2.5)
7
+ rake
8
+ rake (0.8.7)
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ bundler (~> 1.0.0)
15
+ jeweler (~> 1.6.4)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Jake Douglas
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ [Fowler-Noll-Vo hash](http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash)
2
+ ====================
3
+
4
+ ```ruby
5
+ gem install fnv
6
+
7
+ require "fnv"
8
+
9
+ FNV.new.fnv1a_64("blah") => 14233852691173593346
10
+ ```
11
+
12
+ Supported hashes are fnv1_32, fnv1_64, fnv1a_32, and fnv1a_64.
13
+
14
+ There are other implementations but they use C.
15
+
16
+ Test cases were taken from [here](https://github.com/jakedouglas/fnv/blob/master/test_fnv.c).
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ # dependencies defined in Gemfile
16
+ gem.name = "fnv"
17
+ gem.summary = "fnv1 and fnv1a hash functions in pure ruby"
18
+ gem.email = "jakecdouglas@gmail.com"
19
+ gem.homepage = "https://github.com/jakedouglas/fnv"
20
+ gem.authors = ["Jake Douglas"]
21
+ gem.license = "MIT"
22
+ end
23
+ Jeweler::RubygemsDotOrgTasks.new
24
+
25
+ task :default => :test
26
+
27
+ task :test do
28
+ require "test/fnv_test.rb"
29
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,52 @@
1
+ class FNV
2
+ INIT32 = 0x811c9dc5
3
+ INIT64 = 0xcbf29ce484222325
4
+ PRIME32 = 0x01000193
5
+ PRIME64 = 0x100000001b3
6
+ MASK32 = 0xffffffff
7
+ MASK64 = 0xffffffffffffffff
8
+
9
+ def fnv1_32(data)
10
+ hash = INIT32
11
+
12
+ data.bytes.each do |byte|
13
+ hash = hash * PRIME32
14
+ hash = hash ^ byte
15
+ end
16
+
17
+ hash & MASK32
18
+ end
19
+
20
+ def fnv1_64(data)
21
+ hash = INIT64
22
+
23
+ data.bytes.each do |byte|
24
+ hash = hash * PRIME64
25
+ hash = hash ^ byte
26
+ end
27
+
28
+ hash & MASK64
29
+ end
30
+
31
+ def fnv1a_32(data)
32
+ hash = INIT32
33
+
34
+ data.bytes.each do |byte|
35
+ hash = hash ^ byte
36
+ hash = hash * PRIME32
37
+ end
38
+
39
+ hash & MASK32
40
+ end
41
+
42
+ def fnv1a_64(data)
43
+ hash = INIT64
44
+
45
+ data.bytes.each do |byte|
46
+ hash = hash ^ byte
47
+ hash = hash * PRIME64
48
+ end
49
+
50
+ hash & MASK64
51
+ end
52
+ end
@@ -0,0 +1,624 @@
1
+ require "test/unit"
2
+ require File.join(File.dirname(__FILE__), "..", "lib", "fnv")
3
+
4
+ class FnvTest < Test::Unit::TestCase
5
+ def test_fnv1_32
6
+ {
7
+ "" => 0x811c9dc5,
8
+ "a" => 0x050c5d7e,
9
+ "b" => 0x050c5d7d,
10
+ "c" => 0x050c5d7c,
11
+ "d" => 0x050c5d7b,
12
+ "e" => 0x050c5d7a,
13
+ "f" => 0x050c5d79,
14
+ "fo" => 0x6b772514,
15
+ "foo" => 0x408f5e13,
16
+ "foob" => 0xb4b1178b,
17
+ "fooba" => 0xfdc80fb0,
18
+ "foobar" => 0x31f0b262,
19
+ "ch" => 0x6e772a5c,
20
+ "cho" => 0x4197aebb,
21
+ "chon" => 0xfcc8100f,
22
+ "chong" => 0xfdf147fa,
23
+ "chongo" => 0xbcd44ee1,
24
+ "chongo " => 0x23382c13,
25
+ "chongo w" => 0x846d619e,
26
+ "chongo wa" => 0x1630abdb,
27
+ "chongo was" => 0xc99e89b2,
28
+ "chongo was " => 0x1692c316,
29
+ "chongo was h" => 0x9f091bca,
30
+ "chongo was he" => 0x2556be9b,
31
+ "chongo was her" => 0x628e0e73,
32
+ "chongo was here" => 0x98a0bf6c,
33
+ "chongo was here!" => 0xb10d5725,
34
+ "chongo was here!\n" => 0xdd002f35,
35
+ "cu" => 0x6e772a41,
36
+ "cur" => 0x26978421,
37
+ "curd" => 0xe184ff97,
38
+ "curds" => 0x9b5e5ac6,
39
+ "curds " => 0x5b88e592,
40
+ "curds a" => 0xaa8164b7,
41
+ "curds an" => 0x20b18c7b,
42
+ "curds and" => 0xf28025c5,
43
+ "curds and " => 0x84bb753f,
44
+ "curds and w" => 0x3219925a,
45
+ "curds and wh" => 0x384163c6,
46
+ "curds and whe" => 0x54f010d7,
47
+ "curds and whey" => 0x8cea820c,
48
+ "curds and whey\n" => 0xe12ab8ee,
49
+ "hi" => 0x6977223c,
50
+ "hello" => 0xb6fa7167,
51
+ "\xff\x00\x00\x01" => 0xb78320a1,
52
+ "\x01\x00\x00\xff" => 0x0caf4135,
53
+ "\xff\x00\x00\x02" => 0xb78320a2,
54
+ "\x02\x00\x00\xff" => 0xcdc88e80,
55
+ "\xff\x00\x00\x03" => 0xb78320a3,
56
+ "\x03\x00\x00\xff" => 0x8ee1dbcb,
57
+ "\xff\x00\x00\x04" => 0xb78320a4,
58
+ "\x04\x00\x00\xff" => 0x4ffb2716,
59
+ "\x40\x51\x4e\x44" => 0x860632aa,
60
+ "\x44\x4e\x51\x40" => 0xcc2c5c64,
61
+ "\x40\x51\x4e\x4a" => 0x860632a4,
62
+ "\x4a\x4e\x51\x40" => 0x2a7ec4a6,
63
+ "\x40\x51\x4e\x54" => 0x860632ba,
64
+ "\x54\x4e\x51\x40" => 0xfefe8e14,
65
+ "127.0.0.1" => 0x0a3cffd8,
66
+ "127.0.0.2" => 0x0a3cffdb,
67
+ "127.0.0.3" => 0x0a3cffda,
68
+ "64.81.78.68" => 0xc07167d7,
69
+ "64.81.78.74" => 0xbf716668,
70
+ "64.81.78.84" => 0xc6717155,
71
+ "feedface" => 0x7662e0d6,
72
+ "feedfacedaffdeed" => 0xc2732f95,
73
+ "feedfacedeadbeef" => 0x3a19c02a,
74
+ "line 1\nline 2\nline 3" => 0x31ae8f83,
75
+ "chongo <Landon Curt Noll> /\\../\\" => 0x995fa9c4,
76
+ "chongo (Landon Curt Noll) /\\../\\" => 0x5036a251,
77
+ "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0xb4448d60,
78
+ "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0x025dfe59,
79
+ "http://epod.usra.edu/" => 0xc5eab3af,
80
+ "http://exoplanet.eu/" => 0x7d21ba1e,
81
+ "http://hvo.wr.usgs.gov/cam3/" => 0x7704cddb,
82
+ "http://hvo.wr.usgs.gov/cams/HMcam/" => 0xd0071bfe,
83
+ "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0x0ff3774c,
84
+ "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0xb0fea0ea,
85
+ "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0x58177303,
86
+ "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x4f599cda,
87
+ "http://neo.jpl.nasa.gov/risk/" => 0x3e590a47,
88
+ "http://norvig.com/21-days.html" => 0x965595f8,
89
+ "http://primes.utm.edu/curios/home.php" => 0xc37f178d,
90
+ "http://slashdot.org/" => 0x9711dd26,
91
+ "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0x23c99b7f,
92
+ "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x6e568b17,
93
+ "http://www.avo.alaska.edu/activity/Redoubt.php" => 0x43f0245b,
94
+ "http://www.dilbert.com/fast/" => 0xbcb7a001,
95
+ "http://www.fourmilab.ch/gravitation/orbits/" => 0x12e6dffe,
96
+ "http://www.fpoa.net/" => 0x0792f2d6,
97
+ "http://www.ioccc.org/index.html" => 0xb966936b,
98
+ "http://www.isthe.com/cgi-bin/number.cgi" => 0x46439ac5,
99
+ "http://www.isthe.com/chongo/bio.html" => 0x728d49af,
100
+ "http://www.isthe.com/chongo/index.html" => 0xd33745c9,
101
+ "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0xbc382a57,
102
+ "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x4bda1d31,
103
+ "http://www.isthe.com/chongo/tech/astro/vita.html" => 0xce35ccae,
104
+ "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x3b6eed94,
105
+ "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0x445c9c58,
106
+ "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0x3db8bf9d,
107
+ "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0x2dee116d,
108
+ "http://www.isthe.com/chongo/tech/math/number/number.html" => 0xc18738da,
109
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0x5b156176,
110
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0x2aa7d593,
111
+ "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0xb2409658,
112
+ "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0xe1489528,
113
+ "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0xfe1ee07e,
114
+ "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0xe8842315,
115
+ "http://www.lavarnd.org/index.html" => 0x3a6a63a2,
116
+ "http://www.lavarnd.org/what/nist-test.html" => 0x06d2c18c,
117
+ "http://www.macosxhints.com/" => 0xf8ef7225,
118
+ "http://www.mellis.com/" => 0x843d3300,
119
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0xbb24f7ae,
120
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x878c0ec9,
121
+ "http://www.paulnoll.com/" => 0xb557810f,
122
+ "http://www.pepysdiary.com/" => 0x57423246,
123
+ "http://www.sciencenews.org/index/home/activity/view" => 0x87f7505e,
124
+ "http://www.skyandtelescope.com/" => 0xbb809f20,
125
+ "http://www.sput.nl/~rob/sirius.html" => 0x8932abb5,
126
+ "http://www.systemexperts.com/" => 0x0a9b3aa0,
127
+ "http://www.tq-international.com/phpBB3/index.php" => 0xb8682a24,
128
+ "http://www.travelquesttours.com/index.htm" => 0xa7ac1c56,
129
+ "http://www.wunderground.com/global/stations/89606.html" => 0x11409252,
130
+ "21701" * 10 => 0xa987f517,
131
+ "M21701" * 10 => 0xf309e7ed,
132
+ "2^21701-1" * 10 => 0xc9e8f417,
133
+ "\x54\xc5" * 10 => 0x7f447bdd,
134
+ "\xc5\x54" * 10 => 0xb929adc5,
135
+ "23209" * 10 => 0x57022879,
136
+ "M23209" * 10 => 0xdcfd2c49,
137
+ "2^23209-1" * 10 => 0x6edafff5,
138
+ "\x5a\xa9" * 10 => 0xf04fb1f1,
139
+ "\xa9\x5a" * 10 => 0xfb7de8b9,
140
+ "391581216093" * 10 => 0xc5f1d7e9,
141
+ "391581*2^216093-1" * 10 => 0x32c1f439,
142
+ "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0x7fd3eb7d,
143
+ "FEDCBA9876543210" * 10 => 0x81597da5,
144
+ "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0x05eb7a25,
145
+ "EFCDAB8967452301" * 10 => 0x9c0fa1b5,
146
+ "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0x53ccb1c5,
147
+ "0123456789ABCDEF" * 10 => 0xfabece15,
148
+ "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0x4ad745a5,
149
+ "1032547698BADCFE" * 10 => 0xe5bdc495,
150
+ "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0x23b3c0a5,
151
+ "\x00" * 500 => 0xfa823dd5,
152
+ "\x07" * 500 => 0x0c6c58b9,
153
+ "~" * 500 => 0xe2dbccd5,
154
+ "\x7f" * 500 => 0xdb7f50f9
155
+ }.each do |k, v|
156
+ assert_equal v, FNV.new.fnv1_32(k)
157
+ end
158
+ end
159
+
160
+ def test_fnv1a_32
161
+ {
162
+ "" => 0x811c9dc5,
163
+ "a" => 0xe40c292c,
164
+ "b" => 0xe70c2de5,
165
+ "c" => 0xe60c2c52,
166
+ "d" => 0xe10c2473,
167
+ "e" => 0xe00c22e0,
168
+ "f" => 0xe30c2799,
169
+ "fo" => 0x6222e842,
170
+ "foo" => 0xa9f37ed7,
171
+ "foob" => 0x3f5076ef,
172
+ "fooba" => 0x39aaa18a,
173
+ "foobar" => 0xbf9cf968,
174
+ "ch" => 0x5f299f4e,
175
+ "cho" => 0xef8580f3,
176
+ "chon" => 0xac297727,
177
+ "chong" => 0x4546b9c0,
178
+ "chongo" => 0xbd564e7d,
179
+ "chongo " => 0x6bdd5c67,
180
+ "chongo w" => 0xdd77ed30,
181
+ "chongo wa" => 0xf4ca9683,
182
+ "chongo was" => 0x4aeb9bd0,
183
+ "chongo was " => 0xe0e67ad0,
184
+ "chongo was h" => 0xc2d32fa8,
185
+ "chongo was he" => 0x7f743fb7,
186
+ "chongo was her" => 0x6900631f,
187
+ "chongo was here" => 0xc59c990e,
188
+ "chongo was here!" => 0x448524fd,
189
+ "chongo was here!\n" => 0xd49930d5,
190
+ "cu" => 0x4c298165,
191
+ "cur" => 0xfc563735,
192
+ "curd" => 0x8cb91483,
193
+ "curds" => 0x775bf5d0,
194
+ "curds " => 0xd5c428d0,
195
+ "curds a" => 0x34cc0ea3,
196
+ "curds an" => 0xea3b4cb7,
197
+ "curds and" => 0x8e59f029,
198
+ "curds and " => 0x2094de2b,
199
+ "curds and w" => 0xa65a0ad4,
200
+ "curds and wh" => 0x9bbee5f4,
201
+ "curds and whe" => 0xbe836343,
202
+ "curds and whey" => 0x22d5344e,
203
+ "curds and whey\n" => 0x19a1470c,
204
+ "hi" => 0x683af69a,
205
+ "hello" => 0x4f9f2cab,
206
+ "\xff\x00\x00\x01" => 0xc48fb86d,
207
+ "\x01\x00\x00\xff" => 0x2269f369,
208
+ "\xff\x00\x00\x02" => 0xc18fb3b4,
209
+ "\x02\x00\x00\xff" => 0x50ef1236,
210
+ "\xff\x00\x00\x03" => 0xc28fb547,
211
+ "\x03\x00\x00\xff" => 0x96c3bf47,
212
+ "\xff\x00\x00\x04" => 0xbf8fb08e,
213
+ "\x04\x00\x00\xff" => 0xf3e4d49c,
214
+ "\x40\x51\x4e\x44" => 0x32179058,
215
+ "\x44\x4e\x51\x40" => 0x280bfee6,
216
+ "\x40\x51\x4e\x4a" => 0x30178d32,
217
+ "\x4a\x4e\x51\x40" => 0x21addaf8,
218
+ "\x40\x51\x4e\x54" => 0x4217a988,
219
+ "\x54\x4e\x51\x40" => 0x772633d6,
220
+ "127.0.0.1" => 0x08a3d11e,
221
+ "127.0.0.2" => 0x07a3cf8b,
222
+ "127.0.0.3" => 0x06a3cdf8,
223
+ "64.81.78.68" => 0x1d5636a7,
224
+ "64.81.78.74" => 0x1353e852,
225
+ "64.81.78.84" => 0xa55b89ed,
226
+ "feedface" => 0x0588b13c,
227
+ "feedfacedaffdeed" => 0xe83641e1,
228
+ "feedfacedeadbeef" => 0xf1760448,
229
+ "line 1\nline 2\nline 3" => 0x97b4ea23,
230
+ "chongo <Landon Curt Noll> /\\../\\" => 0x9a4e92e6,
231
+ "chongo (Landon Curt Noll) /\\../\\" => 0xf01b2511,
232
+ "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0xce524afa,
233
+ "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0xdd16ef45,
234
+ "http://epod.usra.edu/" => 0x60648bb3,
235
+ "http://exoplanet.eu/" => 0x7fa4bcfc,
236
+ "http://hvo.wr.usgs.gov/cam3/" => 0x5053ae17,
237
+ "http://hvo.wr.usgs.gov/cams/HMcam/" => 0xc9302890,
238
+ "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0x956ded32,
239
+ "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0x9136db84,
240
+ "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0xdf9d3323,
241
+ "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x32bb6cd0,
242
+ "http://neo.jpl.nasa.gov/risk/" => 0xc8f8385b,
243
+ "http://norvig.com/21-days.html" => 0xeb08bfba,
244
+ "http://primes.utm.edu/curios/home.php" => 0x62cc8e3d,
245
+ "http://slashdot.org/" => 0xc3e20f5c,
246
+ "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0x39e97f17,
247
+ "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x7837b203,
248
+ "http://www.avo.alaska.edu/activity/Redoubt.php" => 0x319e877b,
249
+ "http://www.dilbert.com/fast/" => 0xd3e63f89,
250
+ "http://www.fourmilab.ch/gravitation/orbits/" => 0x29b50b38,
251
+ "http://www.fpoa.net/" => 0x5ed678b8,
252
+ "http://www.ioccc.org/index.html" => 0xb0d5b793,
253
+ "http://www.isthe.com/cgi-bin/number.cgi" => 0x52450be5,
254
+ "http://www.isthe.com/chongo/bio.html" => 0xfa72d767,
255
+ "http://www.isthe.com/chongo/index.html" => 0x95066709,
256
+ "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0x7f52e123,
257
+ "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x76966481,
258
+ "http://www.isthe.com/chongo/tech/astro/vita.html" => 0x063258b0,
259
+ "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x2ded6e8a,
260
+ "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0xb07d7c52,
261
+ "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0xd0c71b71,
262
+ "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0xf684f1bd,
263
+ "http://www.isthe.com/chongo/tech/math/number/number.html" => 0x868ecfa8,
264
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0xf794f684,
265
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0xd19701c3,
266
+ "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0x346e171e,
267
+ "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0x91f8f676,
268
+ "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0x0bf58848,
269
+ "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0x6317b6d1,
270
+ "http://www.lavarnd.org/index.html" => 0xafad4c54,
271
+ "http://www.lavarnd.org/what/nist-test.html" => 0x0f25681e,
272
+ "http://www.macosxhints.com/" => 0x91b18d49,
273
+ "http://www.mellis.com/" => 0x7d61c12e,
274
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0x5147d25c,
275
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x9a8b6805,
276
+ "http://www.paulnoll.com/" => 0x4cd2a447,
277
+ "http://www.pepysdiary.com/" => 0x1e549b14,
278
+ "http://www.sciencenews.org/index/home/activity/view" => 0x2fe1b574,
279
+ "http://www.skyandtelescope.com/" => 0xcf0cd31e,
280
+ "http://www.sput.nl/~rob/sirius.html" => 0x6c471669,
281
+ "http://www.systemexperts.com/" => 0x0e5eef1e,
282
+ "http://www.tq-international.com/phpBB3/index.php" => 0x2bed3602,
283
+ "http://www.travelquesttours.com/index.htm" => 0xb26249e0,
284
+ "http://www.wunderground.com/global/stations/89606.html" => 0x2c9b86a4,
285
+ "21701" * 10 => 0xe415e2bb,
286
+ "M21701" * 10 => 0x18a98d1d,
287
+ "2^21701-1" * 10 => 0xb7df8b7b,
288
+ "\x54\xc5" * 10 => 0x241e9075,
289
+ "\xc5\x54" * 10 => 0x063f70dd,
290
+ "23209" * 10 => 0x0295aed9,
291
+ "M23209" * 10 => 0x56a7f781,
292
+ "2^23209-1" * 10 => 0x253bc645,
293
+ "\x5a\xa9" * 10 => 0x46610921,
294
+ "\xa9\x5a" * 10 => 0x7c1577f9,
295
+ "391581216093" * 10 => 0x512b2851,
296
+ "391581*2^216093-1" * 10 => 0x76823999,
297
+ "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0xc0586935,
298
+ "FEDCBA9876543210" * 10 => 0xf3415c85,
299
+ "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0x0ae4ff65,
300
+ "EFCDAB8967452301" * 10 => 0x58b79725,
301
+ "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0xdea43aa5,
302
+ "0123456789ABCDEF" * 10 => 0x2bb3be35,
303
+ "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0xea777a45,
304
+ "1032547698BADCFE" * 10 => 0x8f21c305,
305
+ "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0x5c9d0865,
306
+ "\x00" * 500 => 0xfa823dd5,
307
+ "\x07" * 500 => 0x21a27271,
308
+ "~" * 500 => 0x83c5c6d5,
309
+ "\x7f" * 500 => 0x813b0881
310
+ }.each do |k, v|
311
+ assert_equal v, FNV.new.fnv1a_32(k)
312
+ end
313
+ end
314
+
315
+ def test_fnv1_64
316
+ {
317
+ "" => 0xcbf29ce484222325,
318
+ "a" => 0xaf63bd4c8601b7be,
319
+ "b" => 0xaf63bd4c8601b7bd,
320
+ "c" => 0xaf63bd4c8601b7bc,
321
+ "d" => 0xaf63bd4c8601b7bb,
322
+ "e" => 0xaf63bd4c8601b7ba,
323
+ "f" => 0xaf63bd4c8601b7b9,
324
+ "fo" => 0x08326207b4eb2f34,
325
+ "foo" => 0xd8cbc7186ba13533,
326
+ "foob" => 0x0378817ee2ed65cb,
327
+ "fooba" => 0xd329d59b9963f790,
328
+ "foobar" => 0x340d8765a4dda9c2,
329
+ "ch" => 0x08326507b4eb341c,
330
+ "cho" => 0xd8d5c8186ba98bfb,
331
+ "chon" => 0x1ccefc7ef118dbef,
332
+ "chong" => 0x0c92fab3ad3db77a,
333
+ "chongo" => 0x9b77794f5fdec421,
334
+ "chongo " => 0x0ac742dfe7874433,
335
+ "chongo w" => 0xd7dad5766ad8e2de,
336
+ "chongo wa" => 0xa1bb96378e897f5b,
337
+ "chongo was" => 0x5b3f9b6733a367d2,
338
+ "chongo was " => 0xb07ce25cbea969f6,
339
+ "chongo was h" => 0x8d9e9997f9df0d6a,
340
+ "chongo was he" => 0x838c673d9603cb7b,
341
+ "chongo was her" => 0x8b5ee8a5e872c273,
342
+ "chongo was here" => 0x4507c4e9fb00690c,
343
+ "chongo was here!" => 0x4c9ca59581b27f45,
344
+ "chongo was here!\n" => 0xe0aca20b624e4235,
345
+ "cu" => 0x08326507b4eb3401,
346
+ "cur" => 0xd8d5ad186ba95dc1,
347
+ "curd" => 0x1c72e17ef0ca4e97,
348
+ "curds" => 0x2183c1b327c38ae6,
349
+ "curds " => 0xb66d096c914504f2,
350
+ "curds a" => 0x404bf57ad8476757,
351
+ "curds an" => 0x887976bd815498bb,
352
+ "curds and" => 0x3afd7f02c2bf85a5,
353
+ "curds and " => 0xfc4476b0eb70177f,
354
+ "curds and w" => 0x186d2da00f77ecba,
355
+ "curds and wh" => 0xf97140fa48c74066,
356
+ "curds and whe" => 0xa2b1cf49aa926d37,
357
+ "curds and whey" => 0x0690712cd6cf940c,
358
+ "curds and whey\n" => 0xf7045b3102b8906e,
359
+ "hi" => 0x08326007b4eb2b9c,
360
+ "hello" => 0x7b495389bdbdd4c7,
361
+ "\xff\x00\x00\x01" => 0xd6b2b17bf4b71261,
362
+ "\x01\x00\x00\xff" => 0x447bfb7f98e615b5,
363
+ "\xff\x00\x00\x02" => 0xd6b2b17bf4b71262,
364
+ "\x02\x00\x00\xff" => 0x3bd2807f93fe1660,
365
+ "\xff\x00\x00\x03" => 0xd6b2b17bf4b71263,
366
+ "\x03\x00\x00\xff" => 0x3329057f8f16170b,
367
+ "\xff\x00\x00\x04" => 0xd6b2b17bf4b71264,
368
+ "\x04\x00\x00\xff" => 0x2a7f8a7f8a2e19b6,
369
+ "\x40\x51\x4e\x44" => 0x23d3767e64b2f98a,
370
+ "\x44\x4e\x51\x40" => 0xff768d7e4f9d86a4,
371
+ "\x40\x51\x4e\x4a" => 0x23d3767e64b2f984,
372
+ "\x4a\x4e\x51\x40" => 0xccd1837e334e4aa6,
373
+ "\x40\x51\x4e\x54" => 0x23d3767e64b2f99a,
374
+ "\x54\x4e\x51\x40" => 0x7691fd7e028f6754,
375
+ "127.0.0.1" => 0x34ad3b1041204318,
376
+ "127.0.0.2" => 0x34ad3b104120431b,
377
+ "127.0.0.3" => 0x34ad3b104120431a,
378
+ "64.81.78.68" => 0x02a17ebca4aa3497,
379
+ "64.81.78.74" => 0x02a17dbca4aa32c8,
380
+ "64.81.78.84" => 0x02a184bca4aa3ed5,
381
+ "feedface" => 0x5c2c346706186f36,
382
+ "feedfacedaffdeed" => 0xed9478212b267395,
383
+ "feedfacedeadbeef" => 0x8c54f0203249438a,
384
+ "line 1\nline 2\nline 3" => 0xa64e5f36c9e2b0e3,
385
+ "chongo <Landon Curt Noll> /\\../\\" => 0x8fd0680da3088a04,
386
+ "chongo (Landon Curt Noll) /\\../\\" => 0xb37d55d81c57b331,
387
+ "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0xcb27f4b8e1b6cc20,
388
+ "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0x26caf88bcbef2d19,
389
+ "http://epod.usra.edu/" => 0x8e6e063b97e61b8f,
390
+ "http://exoplanet.eu/" => 0xb42750f7f3b7c37e,
391
+ "http://hvo.wr.usgs.gov/cam3/" => 0xf3c6ba64cf7ca99b,
392
+ "http://hvo.wr.usgs.gov/cams/HMcam/" => 0xebfb69b427ea80fe,
393
+ "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0x39b50c3ed970f46c,
394
+ "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0x5b9b177aa3eb3e8a,
395
+ "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0x6510063ecf4ec903,
396
+ "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x2b3bbd2c00797c7a,
397
+ "http://neo.jpl.nasa.gov/risk/" => 0xf1d6204ff5cb4aa7,
398
+ "http://norvig.com/21-days.html" => 0x4836e27ccf099f38,
399
+ "http://primes.utm.edu/curios/home.php" => 0x82efbb0dd073b44d,
400
+ "http://slashdot.org/" => 0x4a80c282ffd7d4c6,
401
+ "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0x305d1a9c9ee43bdf,
402
+ "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x15c366948ffc6997,
403
+ "http://www.avo.alaska.edu/activity/Redoubt.php" => 0x80153ae218916e7b,
404
+ "http://www.dilbert.com/fast/" => 0xfa23e2bdf9e2a9e1,
405
+ "http://www.fourmilab.ch/gravitation/orbits/" => 0xd47e8d8a2333c6de,
406
+ "http://www.fpoa.net/" => 0x7e128095f688b056,
407
+ "http://www.ioccc.org/index.html" => 0x2f5356890efcedab,
408
+ "http://www.isthe.com/cgi-bin/number.cgi" => 0x95c2b383014f55c5,
409
+ "http://www.isthe.com/chongo/bio.html" => 0x4727a5339ce6070f,
410
+ "http://www.isthe.com/chongo/index.html" => 0xb0555ecd575108e9,
411
+ "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0x48d785770bb4af37,
412
+ "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x09d4701c12af02b1,
413
+ "http://www.isthe.com/chongo/tech/astro/vita.html" => 0x79f031e78f3cf62e,
414
+ "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x52a1ee85db1b5a94,
415
+ "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0x6bd95b2eb37fa6b8,
416
+ "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0x74971b7077aef85d,
417
+ "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0xb4e4fae2ffcc1aad,
418
+ "http://www.isthe.com/chongo/tech/math/number/number.html" => 0x2bd48bd898b8f63a,
419
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0xe9966ac1556257f6,
420
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0x92a3d1cd078ba293,
421
+ "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0xf81175a482e20ab8,
422
+ "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0x5bbb3de722e73048,
423
+ "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0x6b4f363492b9f2be,
424
+ "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0xc2d559df73d59875,
425
+ "http://www.lavarnd.org/index.html" => 0xf75f62284bc7a8c2,
426
+ "http://www.lavarnd.org/what/nist-test.html" => 0xda8dd8e116a9f1cc,
427
+ "http://www.macosxhints.com/" => 0xbdc1e6ab76057885,
428
+ "http://www.mellis.com/" => 0xfec6a4238a1224a0,
429
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0xc03f40f3223e290e,
430
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x1ed21673466ffda9,
431
+ "http://www.paulnoll.com/" => 0xdf70f906bb0dd2af,
432
+ "http://www.pepysdiary.com/" => 0xf3dcda369f2af666,
433
+ "http://www.sciencenews.org/index/home/activity/view" => 0x9ebb11573cdcebde,
434
+ "http://www.skyandtelescope.com/" => 0x81c72d9077fedca0,
435
+ "http://www.sput.nl/~rob/sirius.html" => 0x0ec074a31be5fb15,
436
+ "http://www.systemexperts.com/" => 0x2a8b3280b6c48f20,
437
+ "http://www.tq-international.com/phpBB3/index.php" => 0xfd31777513309344,
438
+ "http://www.travelquesttours.com/index.htm" => 0x194534a86ad006b6,
439
+ "http://www.wunderground.com/global/stations/89606.html" => 0x3be6fdf46e0cfe12,
440
+ "21701" * 10 => 0x017cc137a07eb057,
441
+ "M21701" * 10 => 0x9428fc6e7d26b54d,
442
+ "2^21701-1" * 10 => 0x9aaa2e3603ef8ad7,
443
+ "\x54\xc5" * 10 => 0x82c6d3f3a0ccdf7d,
444
+ "\xc5\x54" * 10 => 0xc86eeea00cf09b65,
445
+ "23209" * 10 => 0x705f8189dbb58299,
446
+ "M23209" * 10 => 0x415a7f554391ca69,
447
+ "2^23209-1" * 10 => 0xcfe3d49fa2bdc555,
448
+ "\x5a\xa9" * 10 => 0xf0f9c56039b25191,
449
+ "\xa9\x5a" * 10 => 0x7075cb6abd1d32d9,
450
+ "391581216093" * 10 => 0x43c94e2c8b277509,
451
+ "391581*2^216093-1" * 10 => 0x3cbfd4e4ea670359,
452
+ "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0xc05887810f4d019d,
453
+ "FEDCBA9876543210" * 10 => 0x14468ff93ac22dc5,
454
+ "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0xebed699589d99c05,
455
+ "EFCDAB8967452301" * 10 => 0x6d99f6df321ca5d5,
456
+ "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0x0cd410d08c36d625,
457
+ "0123456789ABCDEF" * 10 => 0xef1b2a2c86831d35,
458
+ "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0x3b349c4d69ee5f05,
459
+ "1032547698BADCFE" * 10 => 0x55248ce88f45f035,
460
+ "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0xaa69ca6a18a4c885,
461
+ "\x00" * 500 => 0x1fe3fce62bd816b5,
462
+ "\x07" * 500 => 0x0289a488a8df69d9,
463
+ "~" * 500 => 0x15e96e1613df98b5,
464
+ "\x7f" * 500 => 0xe6be57375ad89b99
465
+ }.each do |k, v|
466
+ assert_equal v, FNV.new.fnv1_64(k)
467
+ end
468
+ end
469
+
470
+ def test_fnv1a_64
471
+ {
472
+ "" => 0xcbf29ce484222325,
473
+ "a" => 0xaf63dc4c8601ec8c,
474
+ "b" => 0xaf63df4c8601f1a5,
475
+ "c" => 0xaf63de4c8601eff2,
476
+ "d" => 0xaf63d94c8601e773,
477
+ "e" => 0xaf63d84c8601e5c0,
478
+ "f" => 0xaf63db4c8601ead9,
479
+ "fo" => 0x08985907b541d342,
480
+ "foo" => 0xdcb27518fed9d577,
481
+ "foob" => 0xdd120e790c2512af,
482
+ "fooba" => 0xcac165afa2fef40a,
483
+ "foobar" => 0x85944171f73967e8,
484
+ "ch" => 0x08a25607b54a22ae,
485
+ "cho" => 0xf5faf0190cf90df3,
486
+ "chon" => 0xf27397910b3221c7,
487
+ "chong" => 0x2c8c2b76062f22e0,
488
+ "chongo" => 0xe150688c8217b8fd,
489
+ "chongo " => 0xf35a83c10e4f1f87,
490
+ "chongo w" => 0xd1edd10b507344d0,
491
+ "chongo wa" => 0x2a5ee739b3ddb8c3,
492
+ "chongo was" => 0xdcfb970ca1c0d310,
493
+ "chongo was " => 0x4054da76daa6da90,
494
+ "chongo was h" => 0xf70a2ff589861368,
495
+ "chongo was he" => 0x4c628b38aed25f17,
496
+ "chongo was her" => 0x9dd1f6510f78189f,
497
+ "chongo was here" => 0xa3de85bd491270ce,
498
+ "chongo was here!" => 0x858e2fa32a55e61d,
499
+ "chongo was here!\n" => 0x46810940eff5f915,
500
+ "cu" => 0x08a24307b54a0265,
501
+ "cur" => 0xf5b9fd190cc18d15,
502
+ "curd" => 0x4c968290ace35703,
503
+ "curds" => 0x07174bd5c64d9350,
504
+ "curds " => 0x5a294c3ff5d18750,
505
+ "curds a" => 0x05b3c1aeb308b843,
506
+ "curds an" => 0xb92a48da37d0f477,
507
+ "curds and" => 0x73cdddccd80ebc49,
508
+ "curds and " => 0xd58c4c13210a266b,
509
+ "curds and w" => 0xe78b6081243ec194,
510
+ "curds and wh" => 0xb096f77096a39f34,
511
+ "curds and whe" => 0xb425c54ff807b6a3,
512
+ "curds and whey" => 0x23e520e2751bb46e,
513
+ "curds and whey\n" => 0x1a0b44ccfe1385ec,
514
+ "hi" => 0x08ba5f07b55ec3da,
515
+ "hello" => 0xa430d84680aabd0b,
516
+ "\xff\x00\x00\x01" => 0x6961196491cc682d,
517
+ "\x01\x00\x00\xff" => 0xad2bb1774799dfe9,
518
+ "\xff\x00\x00\x02" => 0x6961166491cc6314,
519
+ "\x02\x00\x00\xff" => 0x8d1bb3904a3b1236,
520
+ "\xff\x00\x00\x03" => 0x6961176491cc64c7,
521
+ "\x03\x00\x00\xff" => 0xed205d87f40434c7,
522
+ "\xff\x00\x00\x04" => 0x6961146491cc5fae,
523
+ "\x04\x00\x00\xff" => 0xcd3baf5e44f8ad9c,
524
+ "\x40\x51\x4e\x44" => 0xe3b36596127cd6d8,
525
+ "\x44\x4e\x51\x40" => 0xf77f1072c8e8a646,
526
+ "\x40\x51\x4e\x4a" => 0xe3b36396127cd372,
527
+ "\x4a\x4e\x51\x40" => 0x6067dce9932ad458,
528
+ "\x40\x51\x4e\x54" => 0xe3b37596127cf208,
529
+ "\x54\x4e\x51\x40" => 0x4b7b10fa9fe83936,
530
+ "127.0.0.1" => 0xaabafe7104d914be,
531
+ "127.0.0.2" => 0xaabafd7104d9130b,
532
+ "127.0.0.3" => 0xaabafc7104d91158,
533
+ "64.81.78.68" => 0xe729bac5d2a8d3a7,
534
+ "64.81.78.74" => 0xe72630c5d2a5b352,
535
+ "64.81.78.84" => 0xe73042c5d2ae266d,
536
+ "feedface" => 0x0a83c86fee952abc,
537
+ "feedfacedaffdeed" => 0x3e66d3d56b8caca1,
538
+ "feedfacedeadbeef" => 0xcac54572bb1a6fc8,
539
+ "line 1\nline 2\nline 3" => 0x7829851fac17b143,
540
+ "chongo <Landon Curt Noll> /\\../\\" => 0x2c8f4c9af81bcf06,
541
+ "chongo (Landon Curt Noll) /\\../\\" => 0x3605a2ac253d2db1,
542
+ "http://antwrp.gsfc.nasa.gov/apod/astropix.html" => 0x6be396289ce8a6da,
543
+ "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash" => 0xd9b957fb7fe794c5,
544
+ "http://epod.usra.edu/" => 0x05be33da04560a93,
545
+ "http://exoplanet.eu/" => 0x0957f1577ba9747c,
546
+ "http://hvo.wr.usgs.gov/cam3/" => 0xda2cc3acc24fba57,
547
+ "http://hvo.wr.usgs.gov/cams/HMcam/" => 0x74136f185b29e7f0,
548
+ "http://hvo.wr.usgs.gov/kilauea/update/deformation.html" => 0xb2f2b4590edb93b2,
549
+ "http://hvo.wr.usgs.gov/kilauea/update/images.html" => 0xb3608fce8b86ae04,
550
+ "http://hvo.wr.usgs.gov/kilauea/update/maps.html" => 0x4a3a865079359063,
551
+ "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html" => 0x5b3a7ef496880a50,
552
+ "http://neo.jpl.nasa.gov/risk/" => 0x48fae3163854c23b,
553
+ "http://norvig.com/21-days.html" => 0x07aaa640476e0b9a,
554
+ "http://primes.utm.edu/curios/home.php" => 0x2f653656383a687d,
555
+ "http://slashdot.org/" => 0xa1031f8e7599d79c,
556
+ "http://tux.wr.usgs.gov/Maps/155.25-19.5.html" => 0xa31908178ff92477,
557
+ "http://volcano.wr.usgs.gov/kilaueastatus.php" => 0x097edf3c14c3fb83,
558
+ "http://www.avo.alaska.edu/activity/Redoubt.php" => 0xb51ca83feaa0971b,
559
+ "http://www.dilbert.com/fast/" => 0xdd3c0d96d784f2e9,
560
+ "http://www.fourmilab.ch/gravitation/orbits/" => 0x86cd26a9ea767d78,
561
+ "http://www.fpoa.net/" => 0xe6b215ff54a30c18,
562
+ "http://www.ioccc.org/index.html" => 0xec5b06a1c5531093,
563
+ "http://www.isthe.com/cgi-bin/number.cgi" => 0x45665a929f9ec5e5,
564
+ "http://www.isthe.com/chongo/bio.html" => 0x8c7609b4a9f10907,
565
+ "http://www.isthe.com/chongo/index.html" => 0x89aac3a491f0d729,
566
+ "http://www.isthe.com/chongo/src/calc/lucas-calc" => 0x32ce6b26e0f4a403,
567
+ "http://www.isthe.com/chongo/tech/astro/venus2004.html" => 0x614ab44e02b53e01,
568
+ "http://www.isthe.com/chongo/tech/astro/vita.html" => 0xfa6472eb6eef3290,
569
+ "http://www.isthe.com/chongo/tech/comp/c/expert.html" => 0x9e5d75eb1948eb6a,
570
+ "http://www.isthe.com/chongo/tech/comp/calc/index.html" => 0xb6d12ad4a8671852,
571
+ "http://www.isthe.com/chongo/tech/comp/fnv/index.html" => 0x88826f56eba07af1,
572
+ "http://www.isthe.com/chongo/tech/math/number/howhigh.html" => 0x44535bf2645bc0fd,
573
+ "http://www.isthe.com/chongo/tech/math/number/number.html" => 0x169388ffc21e3728,
574
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html" => 0xf68aac9e396d8224,
575
+ "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest" => 0x8e87d7e7472b3883,
576
+ "http://www.lavarnd.org/cgi-bin/corpspeak.cgi" => 0x295c26caa8b423de,
577
+ "http://www.lavarnd.org/cgi-bin/haiku.cgi" => 0x322c814292e72176,
578
+ "http://www.lavarnd.org/cgi-bin/rand-none.cgi" => 0x8a06550eb8af7268,
579
+ "http://www.lavarnd.org/cgi-bin/randdist.cgi" => 0xef86d60e661bcf71,
580
+ "http://www.lavarnd.org/index.html" => 0x9e5426c87f30ee54,
581
+ "http://www.lavarnd.org/what/nist-test.html" => 0xf1ea8aa826fd047e,
582
+ "http://www.macosxhints.com/" => 0x0babaf9a642cb769,
583
+ "http://www.mellis.com/" => 0x4b3341d4068d012e,
584
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm" => 0xd15605cbc30a335c,
585
+ "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm" => 0x5b21060aed8412e5,
586
+ "http://www.paulnoll.com/" => 0x45e2cda1ce6f4227,
587
+ "http://www.pepysdiary.com/" => 0x50ae3745033ad7d4,
588
+ "http://www.sciencenews.org/index/home/activity/view" => 0xaa4588ced46bf414,
589
+ "http://www.skyandtelescope.com/" => 0xc1b0056c4a95467e,
590
+ "http://www.sput.nl/~rob/sirius.html" => 0x56576a71de8b4089,
591
+ "http://www.systemexperts.com/" => 0xbf20965fa6dc927e,
592
+ "http://www.tq-international.com/phpBB3/index.php" => 0x569f8383c2040882,
593
+ "http://www.travelquesttours.com/index.htm" => 0xe1e772fba08feca0,
594
+ "http://www.wunderground.com/global/stations/89606.html" => 0x4ced94af97138ac4,
595
+ "21701" * 10 => 0xc4112ffb337a82fb,
596
+ "M21701" * 10 => 0xd64a4fd41de38b7d,
597
+ "2^21701-1" * 10 => 0x4cfc32329edebcbb,
598
+ "\x54\xc5" * 10 => 0x0803564445050395,
599
+ "\xc5\x54" * 10 => 0xaa1574ecf4642ffd,
600
+ "23209" * 10 => 0x694bc4e54cc315f9,
601
+ "M23209" * 10 => 0xa3d7cb273b011721,
602
+ "2^23209-1" * 10 => 0x577c2f8b6115bfa5,
603
+ "\x5a\xa9" * 10 => 0xb7ec8c1a769fb4c1,
604
+ "\xa9\x5a" * 10 => 0x5d5cfce63359ab19,
605
+ "391581216093" * 10 => 0x33b96c3cd65b5f71,
606
+ "391581*2^216093-1" * 10 => 0xd845097780602bb9,
607
+ "\x05\xf9\x9d\x03\x4c\x81" * 10 => 0x84d47645d02da3d5,
608
+ "FEDCBA9876543210" * 10 => 0x83544f33b58773a5,
609
+ "\xfe\xdc\xba\x98\x76\x54\x32\x10" * 10 => 0x9175cbb2160836c5,
610
+ "EFCDAB8967452301" * 10 => 0xc71b3bc175e72bc5,
611
+ "\xef\xcd\xab\x89\x67\x45\x23\x01" * 10 => 0x636806ac222ec985,
612
+ "0123456789ABCDEF" * 10 => 0xb6ef0e6950f52ed5,
613
+ "\x01\x23\x45\x67\x89\xab\xcd\xef" * 10 => 0xead3d8a0f3dfdaa5,
614
+ "1032547698BADCFE" * 10 => 0x922908fe9a861ba5,
615
+ "\x10\x32\x54\x76\x98\xba\xdc\xfe" * 10 => 0x6d4821de275fd5c5,
616
+ "\x00" * 500 => 0x1fe3fce62bd816b5,
617
+ "\x07" * 500 => 0xc23e9fccd6f70591,
618
+ "~" * 500 => 0xc1af12bdfe16b5b5,
619
+ "\x7f" * 500 => 0x39e9f18f2f85e221
620
+ }.each do |k, v|
621
+ assert_equal v, FNV.new.fnv1a_64(k)
622
+ end
623
+ end
624
+ end