1 /* 2 * Copyright (C) 2013 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.common.hash; 18 19 20 /** 21 * An enum that contains all of the known hash functions. 22 * 23 * @author Kurt Alfred Kluever 24 */ 25 enum HashFunctionEnum { 26 ADLER32(Hashing.adler32()), 27 CRC32(Hashing.crc32()), 28 GOOD_FAST_HASH_32(Hashing.goodFastHash(32)), 29 GOOD_FAST_HASH_64(Hashing.goodFastHash(64)), 30 GOOD_FAST_HASH_128(Hashing.goodFastHash(128)), 31 GOOD_FAST_HASH_256(Hashing.goodFastHash(256)), 32 MD5(Hashing.md5()), 33 MURMUR3_128(Hashing.murmur3_128()), 34 MURMUR3_32(Hashing.murmur3_32()), 35 MURMUR3_32_FIXED(Hashing.murmur3_32_fixed()), 36 SHA1(Hashing.sha1()), 37 SHA256(Hashing.sha256()), 38 SHA384(Hashing.sha384()), 39 SHA512(Hashing.sha512()), 40 SIP_HASH24(Hashing.sipHash24()), 41 FARMHASH_FINGERPRINT_64(Hashing.farmHashFingerprint64()), 42 43 // Hash functions found in //javatests for comparing against current implementation of CityHash. 44 // These can probably be removed sooner or later. 45 ; 46 47 private final HashFunction hashFunction; 48 HashFunctionEnum(HashFunction hashFunction)49 private HashFunctionEnum(HashFunction hashFunction) { 50 this.hashFunction = hashFunction; 51 } 52 getHashFunction()53 HashFunction getHashFunction() { 54 return hashFunction; 55 } 56 } 57