1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
6 * The library is free for all purposes without any express
12 @file crypt_find_hash_any.c
13 Find a hash, Tom St Denis
17 Find a hash flexibly. First by name then if not present by digest size
18 @param name The name of the hash desired
19 @param digestlen The minimum length of the digest size (octets)
20 @return >= 0 if found, -1 if not present
21 */int find_hash_any(const char *name, int digestlen)
24 LTC_ARGCHK(name != NULL);
27 if (x != -1) return x;
29 LTC_MUTEX_LOCK(<c_hash_mutex);
32 for (x = 0; x < TAB_SIZE; x++) {
33 if (hash_descriptor[x].name == NULL) {
36 if ((int)hash_descriptor[x].hashsize >= digestlen && (int)hash_descriptor[x].hashsize < y) {
38 y = hash_descriptor[x].hashsize;
41 LTC_MUTEX_UNLOCK(<c_hash_mutex);
45 /* ref: $Format:%D$ */
46 /* git commit: $Format:%H$ */
47 /* commit time: $Format:%ai$ */