aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum_init_sha0_hasher.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libhashsum_init_sha0_hasher.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libhashsum_init_sha0_hasher.c b/libhashsum_init_sha0_hasher.c
index 7f420d8..b7d42a8 100644
--- a/libhashsum_init_sha0_hasher.c
+++ b/libhashsum_init_sha0_hasher.c
@@ -38,9 +38,11 @@ finalise_const(struct libhashsum_hasher *this, const void *data, size_t bytes, u
m = &m[r];
bytes -= r;
- libsha1_digest(&this->state.sha0.s, m, (bytes << 3) | (size_t)extra_bits, this->state.sha0.sum);
+ if (!this->hash_output)
+ this->hash_output = this->state.sha0.sum;
+
+ libsha1_digest(&this->state.sha0.s, m, (bytes << 3) | (size_t)extra_bits, this->hash_output);
memset(&this->state.sha0.s, 0, sizeof(this->state.sha0.s));
- this->hash_output = this->state.sha0.sum;
return 0;
}
@@ -66,6 +68,7 @@ libhashsum_init_sha0_hasher(struct libhashsum_hasher *this)
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
+ this->stretch = NULL;
this->destroy = NULL;
libsha1_init(&this->state.sha0.s, LIBSHA1_0);
return 0;