Sat, 07 Nov 2020 10:30:02 +0800
Added tag mips-jdk8u275-b01 for changeset d3b4d62f391f
coleenp@3865 | 1 | /* |
minqi@6351 | 2 | * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
coleenp@3865 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
coleenp@3865 | 4 | * |
coleenp@3865 | 5 | * This code is free software; you can redistribute it and/or modify it |
coleenp@3865 | 6 | * under the terms of the GNU General Public License version 2 only, as |
coleenp@3865 | 7 | * published by the Free Software Foundation. |
coleenp@3865 | 8 | * |
coleenp@3865 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
coleenp@3865 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
coleenp@3865 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
coleenp@3865 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
coleenp@3865 | 13 | * accompanied this code). |
coleenp@3865 | 14 | * |
coleenp@3865 | 15 | * You should have received a copy of the GNU General Public License version |
coleenp@3865 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
coleenp@3865 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
coleenp@3865 | 18 | * |
coleenp@3865 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
coleenp@3865 | 20 | * or visit www.oracle.com if you need additional information or have any |
coleenp@3865 | 21 | * questions. |
coleenp@3865 | 22 | * |
coleenp@3865 | 23 | */ |
coleenp@3865 | 24 | |
coleenp@3865 | 25 | #ifndef SHARE_VM_CLASSFILE_ALTHASHING_HPP |
coleenp@3865 | 26 | #define SHARE_VM_CLASSFILE_ALTHASHING_HPP |
coleenp@3865 | 27 | |
coleenp@3865 | 28 | #include "prims/jni.h" |
vkempik@10008 | 29 | #include "memory/allocation.hpp" |
coleenp@3865 | 30 | |
coleenp@3865 | 31 | /** |
vkempik@10008 | 32 | * Implementation of alternate more secure hashing. |
coleenp@3865 | 33 | */ |
coleenp@3865 | 34 | |
coleenp@3865 | 35 | class AltHashing : AllStatic { |
coleenp@3865 | 36 | |
vkempik@10008 | 37 | // For the seed computation |
vkempik@10008 | 38 | static uint64_t halfsiphash_64(const uint32_t* data, int len); |
vkempik@10008 | 39 | static uint64_t halfsiphash_64(uint64_t seed, const uint32_t* data, int len); |
vkempik@10008 | 40 | #ifndef PRODUCT |
vkempik@10008 | 41 | // Hashing functions used for internal testing |
vkempik@10009 | 42 | static void testHalfsiphash_32_ByteArray(); |
vkempik@10009 | 43 | static void testHalfsiphash_32_CharArray(); |
vkempik@10008 | 44 | static void testHalfsiphash_64_FromReference(); |
vkempik@10008 | 45 | #endif // PRODUCT |
vkempik@10008 | 46 | public: |
vkempik@10008 | 47 | static uint64_t compute_seed(); |
coleenp@3865 | 48 | |
vkempik@10008 | 49 | // For Symbols |
vkempik@10009 | 50 | static uint32_t halfsiphash_32(uint64_t seed, const uint8_t* data, int len); |
vkempik@10008 | 51 | // For Strings |
vkempik@10009 | 52 | static uint32_t halfsiphash_32(uint64_t seed, const uint16_t* data, int len); |
coleenp@3865 | 53 | NOT_PRODUCT(static void test_alt_hash();) |
coleenp@3865 | 54 | }; |
coleenp@3865 | 55 | #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP |