Java Hash Code Calculate combineHashesMurmur(int hash2, int hash1)

Here you can find the source of combineHashesMurmur(int hash2, int hash1)

Description

combine Hashes Murmur

License

Apache License

Declaration

public static final int combineHashesMurmur(int hash2, int hash1) 

Method Source Code

//package com.java2s;
/*/*w  w w. jav  a 2s.  com*/
 Copyright 2016 Goldman Sachs.
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
    
   http://www.apache.org/licenses/LICENSE-2.0
    
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */

public class Main {
    public static final int combineHashesMurmur(int hash2, int hash1) {
        // this is similar to MurmurHash 3 https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp?spec=svn136&r=136
        // it doesn't include the avalanche step, which is probably why it does so badly in uniqueness tests of the lower bits (see TestPerformance)
        hash1 *= 0xcc9e2d51;
        hash1 = Integer.rotateLeft(hash1, 15);
        hash1 *= 0x1b873593;

        hash2 ^= hash1;
        hash2 = Integer.rotateLeft(hash2, 13);
        hash2 = hash2 * 5 + 0xe6546b64;
        return hash2;
    }
}

Related

  1. combineHashCodes(int hashCode1, int hashCode2)
  2. combineHashCodes(int numA, int numB, int numC)
  3. combineHashCodesHelper(int hashCode1, int hashCode2)
  4. combineHashes(int hash1, int hash2)
  5. combineHashesBad(int hash1, int hash2)
  6. combineHashesOld(int hash1, int hash2)
  7. combineHashesUnsorted(final int a, final int b)
  8. generateHash(byte[] data)
  9. generateHash(char[] password, byte[] salt)