Skip to content

Commit 5ffd40d

Browse files
committed
8273341: Update Siphash to version 1.0
Backport-of: 6cf4cd1aa46414d9af17f3704b27d0d381a17ee8
1 parent 0c4803b commit 5ffd40d

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

src/hotspot/share/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 <jeanphilippe.aumasson@gmail.com>
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+
<jeanphilippe.aumasson@gmail.com>
36+
Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
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"
@@ -134,7 +139,9 @@ static uint64_t halfsiphash_finish64(uint32_t v[4], int rounds) {
134139
}
135140

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

src/hotspot/share/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, 2020, 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
@@ -43,7 +43,7 @@ class AltHashing : AllStatic {
4343
static uint64_t compute_seed();
4444

4545
// For Symbols
46-
static uint32_t halfsiphash_32(uint64_t seed, const uint8_t* data, int len);
46+
static uint32_t halfsiphash_32(uint64_t seed, const void* in, int len);
4747
// For Strings
4848
static uint32_t halfsiphash_32(uint64_t seed, const uint16_t* data, int len);
4949
};

0 commit comments

Comments
 (0)