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 * An enum that contains all of the known hash functions. 21 * 22 * @author Kurt Alfred Kluever 23 */ 24 enum HashFunctionEnum { 25 ADLER32(Hashing.adler32()), 26 CRC32(Hashing.crc32()), 27 GOOD_FAST_HASH_32(Hashing.goodFastHash(32)), 28 GOOD_FAST_HASH_64(Hashing.goodFastHash(64)), 29 GOOD_FAST_HASH_128(Hashing.goodFastHash(128)), 30 GOOD_FAST_HASH_256(Hashing.goodFastHash(256)), 31 MD5(Hashing.md5()), 32 MURMUR3_128(Hashing.murmur3_128()), 33 MURMUR3_32(Hashing.murmur3_32()), 34 SHA1(Hashing.sha1()), 35 SHA256(Hashing.sha256()), 36 SHA384(Hashing.sha384()), 37 SHA512(Hashing.sha512()), 38 SIP_HASH24(Hashing.sipHash24()), 39 FARMHASH_FINGERPRINT_64(Hashing.farmHashFingerprint64()), 40 41 // Hash functions found in //javatests for comparing against current implementation of CityHash. 42 // These can probably be removed sooner or later. 43 ; 44 45 private final HashFunction hashFunction; 46 HashFunctionEnum(HashFunction hashFunction)47 private HashFunctionEnum(HashFunction hashFunction) { 48 this.hashFunction = hashFunction; 49 } 50 getHashFunction()51 HashFunction getHashFunction() { 52 return hashFunction; 53 } 54 } 55