diff options
author | Mattias Andrée <maandree@kth.se> | 2024-08-23 22:03:54 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2024-08-23 22:03:54 +0200 |
commit | eb943e0f73d43eb726671e522acf3a8f656b1947 (patch) | |
tree | dd280b21ae48d0db7ceba23318eaa5e987e81eea /libhashsum_init_hasher.c | |
download | libhashsum-eb943e0f73d43eb726671e522acf3a8f656b1947.tar.gz libhashsum-eb943e0f73d43eb726671e522acf3a8f656b1947.tar.bz2 libhashsum-eb943e0f73d43eb726671e522acf3a8f656b1947.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libhashsum_init_hasher.c')
-rw-r--r-- | libhashsum_init_hasher.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libhashsum_init_hasher.c b/libhashsum_init_hasher.c new file mode 100644 index 0000000..fc39758 --- /dev/null +++ b/libhashsum_init_hasher.c @@ -0,0 +1,27 @@ +/* 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); + default: + errno = EINVAL; + return -1; + } +} |