aboutsummaryrefslogtreecommitdiffstats
path: root/digest.c
diff options
context:
space:
mode:
Diffstat (limited to 'digest.c')
-rw-r--r--digest.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/digest.c b/digest.c
index 5dc1600..0b4f474 100644
--- a/digest.c
+++ b/digest.c
@@ -24,6 +24,7 @@ libsha2_digest(struct libsha2_state *restrict state, const char *message, size_t
off = (state->message_size / 8) % state->chunk_size;
if (msglen) {
state->chunk[off] = (unsigned char)*message;
+ state->chunk[off] <<= 8 - msglen;
state->chunk[off] |= (unsigned char)(1 << (7 - msglen));
state->chunk[off] &= (unsigned char)~((1 << (7 - msglen)) - 1);
state->message_size += msglen;