Hashing.java revision 5047
5218N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 5218N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5218N/A * This code is free software; you can redistribute it and/or modify it 5250N/A * under the terms of the GNU General Public License version 2 only, as 5218N/A * published by the Free Software Foundation. 6280N/A * This code is distributed in the hope that it will be useful, but WITHOUT 6280N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5218N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6280N/A * version 2 for more details (a copy is included in the LICENSE file that 5218N/A * You should have received a copy of the GNU General Public License version 5218N/A * 2 along with this work; if not, write to the Free Software Foundation, 2556N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2556N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2556N/A * or visit www.oracle.com if you need additional information or have any 5218N/A * @test @summary Ensure that Murmur3 hash performs according to specification. 6268N/A (
byte)
0x80, (
byte)
0x81, (
byte)
0x82};
6178N/A (
byte)
0x80, (
byte)
0x81, (
byte)
0x82, (
byte)
0x83};
6175N/A (
char)
0x8180, (
char)
0x8382};
5218N/A (
byte)
0x80, (
byte)
0x81, (
byte)
0x82,
(
byte)
0x83, (
byte)
0x84, (
byte)
0x85};
(
char)
0x8180, (
char)
0x8382, (
char)
0x8584};
(
byte)
0x80, (
byte)
0x81, (
byte)
0x82,
(
byte)
0x83, (
byte)
0x84, (
byte)
0x85,
(
byte)
0x86, (
byte)
0x87};
(
char)
0x8180, (
char)
0x8382,
(
char)
0x8584, (
char)
0x8786};
byte[]
vector =
new byte[
256];
byte[]
hashes =
new byte[
4 *
256];
for (
int i =
0; i <
256; i++) {
// Hash subranges {}, {0}, {0,1}, {0,1,2}, ..., {0,...,255} for (
int i =
0; i <
256; i++) {
// hash to get final result. String.
format(
"Calculated hash result not as expected. Expected %08X got %08X",