coleenp@3865: /* minqi@6351: * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. coleenp@3865: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. coleenp@3865: * coleenp@3865: * This code is free software; you can redistribute it and/or modify it coleenp@3865: * under the terms of the GNU General Public License version 2 only, as coleenp@3865: * published by the Free Software Foundation. coleenp@3865: * coleenp@3865: * This code is distributed in the hope that it will be useful, but WITHOUT coleenp@3865: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or coleenp@3865: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License coleenp@3865: * version 2 for more details (a copy is included in the LICENSE file that coleenp@3865: * accompanied this code). coleenp@3865: * coleenp@3865: * You should have received a copy of the GNU General Public License version coleenp@3865: * 2 along with this work; if not, write to the Free Software Foundation, coleenp@3865: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. coleenp@3865: * coleenp@3865: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA coleenp@3865: * or visit www.oracle.com if you need additional information or have any coleenp@3865: * questions. coleenp@3865: * coleenp@3865: */ coleenp@3865: coleenp@3865: #ifndef SHARE_VM_CLASSFILE_ALTHASHING_HPP coleenp@3865: #define SHARE_VM_CLASSFILE_ALTHASHING_HPP coleenp@3865: coleenp@3865: #include "prims/jni.h" vkempik@10008: #include "memory/allocation.hpp" coleenp@3865: coleenp@3865: /** vkempik@10008: * Implementation of alternate more secure hashing. coleenp@3865: */ coleenp@3865: coleenp@3865: class AltHashing : AllStatic { coleenp@3865: vkempik@10008: // For the seed computation vkempik@10008: static uint64_t halfsiphash_64(const uint32_t* data, int len); vkempik@10008: static uint64_t halfsiphash_64(uint64_t seed, const uint32_t* data, int len); vkempik@10008: #ifndef PRODUCT vkempik@10008: // Hashing functions used for internal testing vkempik@10009: static void testHalfsiphash_32_ByteArray(); vkempik@10009: static void testHalfsiphash_32_CharArray(); vkempik@10008: static void testHalfsiphash_64_FromReference(); vkempik@10008: #endif // PRODUCT vkempik@10008: public: vkempik@10008: static uint64_t compute_seed(); coleenp@3865: vkempik@10008: // For Symbols vkempik@10009: static uint32_t halfsiphash_32(uint64_t seed, const uint8_t* data, int len); vkempik@10008: // For Strings vkempik@10009: static uint32_t halfsiphash_32(uint64_t seed, const uint16_t* data, int len); coleenp@3865: NOT_PRODUCT(static void test_alt_hash();) coleenp@3865: }; coleenp@3865: #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP