Commit 7fe8ce98 authored by Nils Goroll's avatar Nils Goroll

generalize the uint32 context member

parent 67400fc2
......@@ -101,7 +101,7 @@ init(const enum algorithm hash, hash_ctx * const hctx)
{
switch(hash) {
case CRC32:
hctx->crc32 = 0;
hctx->uint32[0] = 0;
break;
case MD5:
rhash_md5_init(&hctx->md5);
......@@ -144,7 +144,7 @@ update(const enum algorithm hash, hash_ctx *restrict const hctx,
{
switch(hash) {
case CRC32:
hctx->crc32 = rhash_get_crc32(hctx->crc32, msg, len);
hctx->uint32[0] = rhash_get_crc32(hctx->uint32[0], msg, len);
break;
case MD5:
rhash_md5_update(&hctx->md5, msg, len);
......@@ -179,7 +179,7 @@ final(const enum algorithm hash, hash_ctx *restrict const hctx,
{
switch(hash) {
case CRC32:
be32_copy(result, 0, &hctx->crc32, sizeof(uint32_t));
be32_copy(result, 0, &hctx->uint32[0], sizeof(uint32_t));
break;
case MD5:
rhash_md5_final(&hctx->md5, result);
......
......@@ -52,7 +52,7 @@ enum scope {
};
typedef union hash_ctx {
uint32_t crc32;
uint32_t uint32[2];
md5_ctx md5;
sha1_ctx sha1;
sha256_ctx sha224;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment