c-multihash/src/hashes.c

47 lines
623 B
C
Raw Normal View History

2016-07-26 11:00:54 +00:00
#include "mh/hashes.h"
2016-07-30 10:39:26 +00:00
#include "mh/errors.h"
static const int hash_lengths[] = {
20, // sha1
32, // sha2-256
64, // sha2-512
64, // sha3-512
45, // sha3-364
32, // sha3-256
28, // sha3-224
16, // shake-128
32, // shake-256
2016-07-30 10:39:26 +00:00
64, // blake2b
32, // blake2s
};
int mh_hash_default_length(mh_hash hash) {
if (hash < 0 || hash >= MH_H_COUNT)
2016-07-30 10:39:26 +00:00
return MH_;
2016-07-30 10:39:26 +00:00
return hash_lengths[hash];
}
/*
MH_H_SHA1,
MH_H_SHA2_256,
MH_H_SHA2_512,
MH_H_SHA3_512,
MH_H_SHA3_384,
MH_H_SHA3_256,
MH_H_SHA3_224,
MH_H_SHAKE_128,
MH_H_SHAKE_256,
MH_H_BLAKE2B,
MH_H_BLAKE2S,
HM_H_COUNT // number of hash functions
*/