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