3
|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis |
|
2 * |
|
3 * LibTomCrypt is a library that provides various cryptographic |
|
4 * algorithms in a highly modular and flexible manner. |
|
5 * |
|
6 * The library is free for all purposes without any express |
|
7 * guarantee it works. |
|
8 * |
|
9 * Tom St Denis, [email protected], http://libtomcrypt.org |
|
10 */ |
|
11 #include "mycrypt.h" |
|
12 |
|
13 /* return first hash with at least [amount over] digestlen bytes of output */ |
|
14 int find_hash_any(const char *name, int digestlen) |
|
15 { |
|
16 int x, y, z; |
|
17 _ARGCHK(name != NULL); |
|
18 |
|
19 x = find_hash(name); |
|
20 if (x != -1) return x; |
|
21 |
|
22 y = MAXBLOCKSIZE+1; |
|
23 z = -1; |
|
24 for (x = 0; x < TAB_SIZE; x++) { |
|
25 if (hash_descriptor[x].name == NULL) { |
|
26 continue; |
|
27 } |
|
28 if ((int)hash_descriptor[x].hashsize >= digestlen && (int)hash_descriptor[x].hashsize < y) { |
|
29 z = x; |
|
30 y = hash_descriptor[x].hashsize; |
|
31 } |
|
32 } |
|
33 return z; |
|
34 } |