aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum_init_hasher.c
blob: d747e52595becbd86485c9b8c476ad018a76b982 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* See LICENSE file for copyright and license details. */
#include "common.h"


int
libhashsum_init_hasher(struct libhashsum_hasher *hasher, enum libhashsum_algorithm algorithm)
{
	switch (algorithm) {
	case LIBHASHSUM_MD2:
		return libhashsum_init_md2_hasher(hasher);
	case LIBHASHSUM_MD4:
		return libhashsum_init_md4_hasher(hasher);
	case LIBHASHSUM_MD5:
		return libhashsum_init_md5_hasher(hasher);
	case LIBHASHSUM_RIPEMD_128:
		return libhashsum_init_ripemd_128_hasher(hasher);
	case LIBHASHSUM_RIPEMD_160:
		return libhashsum_init_ripemd_160_hasher(hasher);
	case LIBHASHSUM_RIPEMD_256:
		return libhashsum_init_ripemd_256_hasher(hasher);
	case LIBHASHSUM_RIPEMD_320:
		return libhashsum_init_ripemd_320_hasher(hasher);
	case LIBHASHSUM_SHA0:
		return libhashsum_init_sha0_hasher(hasher);
	case LIBHASHSUM_SHA1:
		return libhashsum_init_sha1_hasher(hasher);
	case LIBHASHSUM_SHA_224:
		return libhashsum_init_sha_224_hasher(hasher);
	case LIBHASHSUM_SHA_256:
		return libhashsum_init_sha_256_hasher(hasher);
	case LIBHASHSUM_SHA_384:
		return libhashsum_init_sha_384_hasher(hasher);
	case LIBHASHSUM_SHA_512:
		return libhashsum_init_sha_512_hasher(hasher);
	case LIBHASHSUM_SHA_512_224:
		return libhashsum_init_sha_512_224_hasher(hasher);
	case LIBHASHSUM_SHA_512_256:
		return libhashsum_init_sha_512_256_hasher(hasher);
	default:
		errno = EINVAL;
		return -1;
	}
}