blob: 6f09629076e2686cc03bf042834dd371692a1a30 (
plain) (
tree)
|
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
int
libhashsum_init_hasher(struct libhashsum_hasher *this, enum libhashsum_algorithm algorithm)
{
switch (algorithm) {
case LIBHASHSUM_MD2:
return libhashsum_init_md2_hasher(this);
case LIBHASHSUM_MD4:
return libhashsum_init_md4_hasher(this);
case LIBHASHSUM_MD5:
return libhashsum_init_md5_hasher(this);
case LIBHASHSUM_RIPEMD_128:
return libhashsum_init_ripemd_128_hasher(this);
case LIBHASHSUM_RIPEMD_160:
return libhashsum_init_ripemd_160_hasher(this);
case LIBHASHSUM_RIPEMD_256:
return libhashsum_init_ripemd_256_hasher(this);
case LIBHASHSUM_RIPEMD_320:
return libhashsum_init_ripemd_320_hasher(this);
case LIBHASHSUM_SHA0:
return libhashsum_init_sha0_hasher(this);
case LIBHASHSUM_SHA1:
return libhashsum_init_sha1_hasher(this);
case LIBHASHSUM_SHA_224:
return libhashsum_init_sha_224_hasher(this);
case LIBHASHSUM_SHA_256:
return libhashsum_init_sha_256_hasher(this);
case LIBHASHSUM_SHA_384:
return libhashsum_init_sha_384_hasher(this);
case LIBHASHSUM_SHA_512:
return libhashsum_init_sha_512_hasher(this);
case LIBHASHSUM_SHA_512_224:
return libhashsum_init_sha_512_224_hasher(this);
case LIBHASHSUM_SHA_512_256:
return libhashsum_init_sha_512_256_hasher(this);
case LIBHASHSUM_KECCAK_224:
return libhashsum_init_keccak_224_hasher(this);
case LIBHASHSUM_KECCAK_256:
return libhashsum_init_keccak_256_hasher(this);
case LIBHASHSUM_KECCAK_384:
return libhashsum_init_keccak_384_hasher(this);
case LIBHASHSUM_KECCAK_512:
return libhashsum_init_keccak_512_hasher(this);
case LIBHASHSUM_SHA3_224:
return libhashsum_init_sha3_224_hasher(this);
case LIBHASHSUM_SHA3_256:
return libhashsum_init_sha3_256_hasher(this);
case LIBHASHSUM_SHA3_384:
return libhashsum_init_sha3_384_hasher(this);
case LIBHASHSUM_SHA3_512:
return libhashsum_init_sha3_512_hasher(this);
case LIBHASHSUM_SHAKE128:
return libhashsum_init_shake128_hasher(this, 0);
case LIBHASHSUM_SHAKE256:
return libhashsum_init_shake256_hasher(this, 0);
case LIBHASHSUM_SHAKE512:
return libhashsum_init_shake512_hasher(this, 0);
case LIBHASHSUM_RAWSHAKE128:
return libhashsum_init_rawshake128_hasher(this, 0);
case LIBHASHSUM_RAWSHAKE256:
return libhashsum_init_rawshake256_hasher(this, 0);
case LIBHASHSUM_RAWSHAKE512:
return libhashsum_init_rawshake512_hasher(this, 0);
case LIBHASHSUM_BLAKE224:
return libhashsum_init_blake224_hasher(this, NULL);
case LIBHASHSUM_BLAKE256:
return libhashsum_init_blake256_hasher(this, NULL);
case LIBHASHSUM_BLAKE384:
return libhashsum_init_blake384_hasher(this, NULL);
case LIBHASHSUM_BLAKE512:
return libhashsum_init_blake512_hasher(this, NULL);
default:
case LIBHASHSUM_KECCAK:
errno = EINVAL;
return -1;
}
}
|