aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum_init_sha1_hasher.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-24 10:04:37 +0200
committerMattias Andrée <maandree@kth.se>2024-08-24 10:04:37 +0200
commitcbe3b01daad36d3ba8f3d2e4c1e0d5645aa44010 (patch)
tree128aa07e1a8e8bb2738b4b3db40d455d2151952c /libhashsum_init_sha1_hasher.c
parentStandardise how to interpret a partial byte (diff)
downloadlibhashsum-cbe3b01daad36d3ba8f3d2e4c1e0d5645aa44010.tar.gz
libhashsum-cbe3b01daad36d3ba8f3d2e4c1e0d5645aa44010.tar.bz2
libhashsum-cbe3b01daad36d3ba8f3d2e4c1e0d5645aa44010.tar.xz
Test partial byte support in SHA1 and SHA-224
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libhashsum_init_sha1_hasher.c')
-rw-r--r--libhashsum_init_sha1_hasher.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libhashsum_init_sha1_hasher.c b/libhashsum_init_sha1_hasher.c
index 25c7496..8287429 100644
--- a/libhashsum_init_sha1_hasher.c
+++ b/libhashsum_init_sha1_hasher.c
@@ -37,7 +37,7 @@ finalise_const(struct libhashsum_hasher *this, const void *data, size_t bytes, u
m = &m[r];
bytes -= r;
- libsha1_digest(&this->state.sha1.s, data, (bytes << 3) | extra_bits, this->state.sha1.sum);
+ libsha1_digest(&this->state.sha1.s, m, (bytes << 3) | (size_t)extra_bits, this->state.sha1.sum);
memset(&this->state.sha1.s, 0, sizeof(this->state.sha1.s));
this->hash_output = this->state.sha1.sum;
return 0;