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 SHA512(Hashing.sha512()), 37 SIP_HASH24(Hashing.sipHash24()), 38 39 // Hash functions found in //javatests for comparing against current implementation of CityHash. 40 // These can probably be removed sooner or later. 41 ; 42 43 private final HashFunction hashFunction; 44 HashFunctionEnum(HashFunction hashFunction)45 private HashFunctionEnum(HashFunction hashFunction) { 46 this.hashFunction = hashFunction; 47 } 48 getHashFunction()49 HashFunction getHashFunction() { 50 return hashFunction; 51 } 52 } 53