]> git.ipfire.org Git - thirdparty/chrony.git/blob - hash.h
hash: enumerate hash algorithms
[thirdparty/chrony.git] / hash.h
1 /*
2 chronyd/chronyc - Programs for keeping computer clocks accurate.
3
4 **********************************************************************
5 * Copyright (C) Miroslav Lichvar 2012
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 **********************************************************************
21
22 =======================================================================
23
24 Header file for crypto hashing.
25
26 */
27
28 #ifndef GOT_HASH_H
29 #define GOT_HASH_H
30
31 /* length of hash values produced by SHA512 */
32 #define MAX_HASH_LENGTH 64
33
34 typedef enum {
35 HSH_INVALID = 0,
36 HSH_MD5 = 1,
37 HSH_SHA1 = 2,
38 HSH_SHA256 = 3,
39 HSH_SHA384 = 4,
40 HSH_SHA512 = 5,
41 HSH_SHA3_224 = 6,
42 HSH_SHA3_256 = 7,
43 HSH_SHA3_384 = 8,
44 HSH_SHA3_512 = 9,
45 HSH_TIGER = 10,
46 HSH_WHIRLPOOL = 11,
47 } HSH_Algorithm;
48
49 extern int HSH_GetHashId(HSH_Algorithm algorithm);
50
51 extern unsigned int HSH_Hash(int id,
52 const unsigned char *in1, unsigned int in1_len,
53 const unsigned char *in2, unsigned int in2_len,
54 unsigned char *out, unsigned int out_len);
55
56 extern void HSH_Finalise(void);
57
58 #endif