Skip to content

Commit

Permalink
8273341: Update Siphash to version 1.0
Browse files Browse the repository at this point in the history
Backport-of: 6cf4cd1aa46414d9af17f3704b27d0d381a17ee8
  • Loading branch information
zhengyu123 committed Jan 20, 2022
1 parent 0c4803b commit 5ffd40d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
33 changes: 20 additions & 13 deletions src/hotspot/share/classfile/altHashing.cpp
Expand Up @@ -26,18 +26,23 @@
* halfsiphash code adapted from reference implementation
* (https://github.com/veorq/SipHash/blob/master/halfsiphash.c)
* which is distributed with the following copyright:
*
* SipHash reference C implementation
*
* Copyright (c) 2016 Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
*
* To the extent possible under law, the author(s) have dedicated all copyright
* and related and neighboring rights to this software to the public domain
* worldwide. This software is distributed without any warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with this software. If not, see
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/

/*
SipHash reference C implementation
Copyright (c) 2012-2021 Jean-Philippe Aumasson
<jeanphilippe.aumasson@gmail.com>
Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along
with
this software. If not, see
<http://creativecommons.org/publicdomain/zero/1.0/>.
*/

#include "precompiled.hpp"
Expand Down Expand Up @@ -134,7 +139,9 @@ static uint64_t halfsiphash_finish64(uint32_t v[4], int rounds) {
}

// HalfSipHash-2-4 (32-bit output) for Symbols
uint32_t AltHashing::halfsiphash_32(uint64_t seed, const uint8_t* data, int len) {
uint32_t AltHashing::halfsiphash_32(uint64_t seed, const void* in, int len) {

const unsigned char* data = (const unsigned char*)in;
uint32_t v[4];
uint32_t newdata;
int off = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/classfile/altHashing.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -43,7 +43,7 @@ class AltHashing : AllStatic {
static uint64_t compute_seed();

// For Symbols
static uint32_t halfsiphash_32(uint64_t seed, const uint8_t* data, int len);
static uint32_t halfsiphash_32(uint64_t seed, const void* in, int len);
// For Strings
static uint32_t halfsiphash_32(uint64_t seed, const uint16_t* data, int len);
};
Expand Down

1 comment on commit 5ffd40d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.