aboutsummaryrefslogtreecommitdiff
path: root/libbb/hash_md5.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/hash_md5.c')
-rw-r--r--libbb/hash_md5.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libbb/hash_md5.c b/libbb/hash_md5.c
index 051c8ede4..9de27f1d9 100644
--- a/libbb/hash_md5.c
+++ b/libbb/hash_md5.c
@@ -417,11 +417,9 @@ void FAST_FUNC md5_end(md5_ctx_t *ctx, void *resbuf)
if (remaining >= 8) {
/* Store the 64-bit counter of bits in the buffer in BE format */
uint64_t t = ctx->total64 << 3;
- unsigned i;
- for (i = 0; i < 8; i++) {
- ctx->wbuffer[56 + i] = t;
- t >>= 8;
- }
+ t = SWAP_BE64(t);
+ /* wbuffer is suitably aligned for this */
+ *(uint64_t *) (&ctx->wbuffer[64 - 8]) = t;
}
md5_process_block64(ctx);
if (remaining >= 8)