hash: make blocklen and hashlen part of the implementation
This commit is contained in:
parent
2b3e390bbf
commit
2ebe3467f8
3
hash.h
3
hash.h
@ -26,6 +26,9 @@ struct lc_hash_impl {
|
||||
|
||||
void *(*ctx_new)(void);
|
||||
void (*ctx_free)(void *);
|
||||
|
||||
size_t blocklen;
|
||||
size_t hashlen;
|
||||
};
|
||||
|
||||
struct lc_hash_ctx {
|
||||
|
@ -266,6 +266,9 @@ static struct lc_hash_impl sha224_impl = {
|
||||
|
||||
.ctx_new = &sha224_sha256_ctx_new,
|
||||
.ctx_free = NULL,
|
||||
|
||||
.blocklen = LC_SHA224_BLOCKLEN,
|
||||
.hashlen = LC_SHA224_HASHLEN,
|
||||
};
|
||||
|
||||
static struct lc_hash_impl sha256_impl = {
|
||||
@ -276,6 +279,9 @@ static struct lc_hash_impl sha256_impl = {
|
||||
|
||||
.ctx_new = &sha224_sha256_ctx_new,
|
||||
.ctx_free = NULL,
|
||||
|
||||
.blocklen = LC_SHA256_BLOCKLEN,
|
||||
.hashlen = LC_SHA256_HASHLEN,
|
||||
};
|
||||
|
||||
const struct lc_hash_impl *
|
||||
|
@ -271,6 +271,9 @@ static struct lc_hash_impl sha384_impl = {
|
||||
|
||||
.ctx_new = &sha384_sha512_ctx_new,
|
||||
.ctx_free = NULL,
|
||||
|
||||
.blocklen = LC_SHA384_BLOCKLEN,
|
||||
.hashlen = LC_SHA384_HASHLEN,
|
||||
};
|
||||
|
||||
static struct lc_hash_impl sha512_impl = {
|
||||
@ -281,6 +284,9 @@ static struct lc_hash_impl sha512_impl = {
|
||||
|
||||
.ctx_new = &sha384_sha512_ctx_new,
|
||||
.ctx_free = NULL,
|
||||
|
||||
.blocklen = LC_SHA512_BLOCKLEN,
|
||||
.hashlen = LC_SHA512_HASHLEN,
|
||||
};
|
||||
|
||||
const struct lc_hash_impl *
|
||||
|
Loading…
Reference in New Issue
Block a user