implemented sha2_hasher which supports SHA-256, SHA-384 and SHA-512
[strongswan.git] / src / libstrongswan / crypto / hashers / sha2_hasher.h
1 /**
2 * @file sha2_hasher.h
3 *
4 * @brief Interface of sha2_hasher_t
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef SHA2_HASHER_H_
24 #define SHA2_HASHER_H_
25
26 #include <crypto/hashers/hasher.h>
27
28
29 typedef struct sha2_hasher_t sha2_hasher_t;
30
31 /**
32 * @brief Implementation of hasher_t interface using the SHA2 algorithms.
33 *
34 * SHA2 is an other name for the SHA-256, SHA-384 and SHA-512 variants of
35 * the SHA hash algorithm.
36 *
37 * @b Constructors:
38 * - hasher_create() using HASH_SHA256, HASH_SHA384 or HASH_SHA512 as algorithm
39 * - sha2_hasher_create()
40 *
41 * @see hasher_t
42 *
43 * @ingroup hashers
44 */
45 struct sha2_hasher_t {
46
47 /**
48 * Generic hasher_t interface for this hasher.
49 */
50 hasher_t hasher_interface;
51 };
52
53 /**
54 * @brief Creates a new sha2_hasher_t.
55 *
56 * @param algorithm HASH_SHA256, HASH_SHA384 or HASH_SHA512
57 * @return sha2_hasher_t object
58 *
59 * @ingroup hashers
60 */
61 sha2_hasher_t *sha2_hasher_create(hash_algorithm_t algorithm);
62
63 #endif /* SHA2_HASHER_H_ */