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

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

Description

combine Hashes Old

License

Apache License

Declaration

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

Method Source Code

//package com.java2s;
/*/*from ww w  .  j a  va2s .  c  o  m*/
 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 FNV_PRIME = 16777619;

    public static final int combineHashesOld(int hash1, int hash2) {
        /* similar to the FNV algorithm, not the same, because java doesn't have unsigned int */
        hash1 ^= (hash2 & 0xff);
        hash1 *= FNV_PRIME;
        hash1 ^= (hash2 >>> 8) & 0xff;
        hash1 *= FNV_PRIME;
        hash1 ^= (hash2 >>> 16) & 0xff;
        hash1 *= FNV_PRIME;
        hash1 ^= (hash2 >>> 24) & 0xff;
        hash1 *= FNV_PRIME;
        return hash1;
    }
}

Related

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