diff options
Diffstat (limited to '')
-rw-r--r-- | libhashsum_init_md5_hasher.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libhashsum_init_md5_hasher.c b/libhashsum_init_md5_hasher.c index 8147204..7eec6ed 100644 --- a/libhashsum_init_md5_hasher.c +++ b/libhashsum_init_md5_hasher.c @@ -138,15 +138,17 @@ finalise_common(struct libhashsum_hasher *this, uint8_t *m, size_t bytes, unsign memset(this->state.md5.w, 0, sizeof(this->state.md5.w)); this->state.md5.count = 0; + if (!this->hash_output) + this->hash_output = this->state.md5.h.sum; + for (i = 0; i < 4U; i++) { hi = this->state.md5.h.h32[i]; - this->state.md5.h.sum[i * 4U + 0U] = (uint8_t)(hi >> 0); - this->state.md5.h.sum[i * 4U + 1U] = (uint8_t)(hi >> 8); - this->state.md5.h.sum[i * 4U + 2U] = (uint8_t)(hi >> 16); - this->state.md5.h.sum[i * 4U + 3U] = (uint8_t)(hi >> 24); + this->hash_output[i * 4U + 0U] = (uint8_t)(hi >> 0); + this->hash_output[i * 4U + 1U] = (uint8_t)(hi >> 8); + this->hash_output[i * 4U + 2U] = (uint8_t)(hi >> 16); + this->hash_output[i * 4U + 3U] = (uint8_t)(hi >> 24); } - this->hash_output = this->state.md5.h.sum; return 0; } @@ -200,6 +202,7 @@ libhashsum_init_md5_hasher(struct libhashsum_hasher *this) this->process = &process; this->finalise_const = &finalise_const; this->finalise = &finalise; + this->stretch = NULL; this->destroy = NULL; memset(&this->state.md5, 0, sizeof(this->state.md5)); this->state.md5.h.h32[0] = UINT32_C(0x67452301); |