Skip to content

Commit 83fbd1c

Browse files
committed
8273341: Update Siphash to version 1.0
Reviewed-by: dholmes
1 parent 4618dfd commit 83fbd1c

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

hotspot/src/share/vm/classfile/altHashing.cpp

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,23 @@
2626
* halfsiphash code adapted from reference implementation
2727
* (https://github.com/veorq/SipHash/blob/master/halfsiphash.c)
2828
* which is distributed with the following copyright:
29-
*
30-
* SipHash reference C implementation
31-
*
32-
* Copyright (c) 2016 Jean-Philippe Aumasson <[email protected]>
33-
*
34-
* To the extent possible under law, the author(s) have dedicated all copyright
35-
* and related and neighboring rights to this software to the public domain
36-
* worldwide. This software is distributed without any warranty.
37-
*
38-
* You should have received a copy of the CC0 Public Domain Dedication along
39-
* with this software. If not, see
40-
* <http://creativecommons.org/publicdomain/zero/1.0/>.
29+
*/
30+
31+
/*
32+
SipHash reference C implementation
33+
34+
Copyright (c) 2012-2021 Jean-Philippe Aumasson
35+
36+
Copyright (c) 2012-2014 Daniel J. Bernstein <[email protected]>
37+
38+
To the extent possible under law, the author(s) have dedicated all copyright
39+
and related and neighboring rights to this software to the public domain
40+
worldwide. This software is distributed without any warranty.
41+
42+
You should have received a copy of the CC0 Public Domain Dedication along
43+
with
44+
this software. If not, see
45+
<http://creativecommons.org/publicdomain/zero/1.0/>.
4146
*/
4247

4348
#include "precompiled.hpp"
@@ -133,7 +138,9 @@ static uint64_t halfsiphash_finish64(uint32_t v[4], int rounds) {
133138
}
134139

135140
// HalfSipHash-2-4 (32-bit output) for Symbols
136-
uint32_t AltHashing::halfsiphash_32(uint64_t seed, const uint8_t* data, int len) {
141+
uint32_t AltHashing::halfsiphash_32(uint64_t seed, const void* in, int len) {
142+
143+
const unsigned char* data = (const unsigned char*)in;
137144
uint32_t v[4];
138145
uint32_t newdata;
139146
int off = 0;

hotspot/src/share/vm/classfile/altHashing.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@ class AltHashing : AllStatic {
4747
static uint64_t compute_seed();
4848

4949
// For Symbols
50-
static uint32_t halfsiphash_32(uint64_t seed, const uint8_t* data, int len);
50+
static uint32_t halfsiphash_32(uint64_t seed, const void* in, int len);
5151
// For Strings
5252
static uint32_t halfsiphash_32(uint64_t seed, const uint16_t* data, int len);
5353
NOT_PRODUCT(static void test_alt_hash();)

0 commit comments

Comments
 (0)