From e08ef581af510312dacba40e78a6af7ca36ffbc5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 18 Oct 2010 11:50:17 +0200 Subject: md5: length should be stored in *little-endian* order! fixing... Signed-off-by: Denys Vlasenko --- libbb/hash_md5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libbb/hash_md5.c') diff --git a/libbb/hash_md5.c b/libbb/hash_md5.c index 9de27f1d9..d7410fa2c 100644 --- a/libbb/hash_md5.c +++ b/libbb/hash_md5.c @@ -415,9 +415,9 @@ void FAST_FUNC md5_end(md5_ctx_t *ctx, void *resbuf) memset(ctx->wbuffer + bufpos, 0, remaining); /* Do we have enough space for the length count? */ if (remaining >= 8) { - /* Store the 64-bit counter of bits in the buffer in BE format */ + /* Store the 64-bit counter of bits in the buffer in LE format */ uint64_t t = ctx->total64 << 3; - t = SWAP_BE64(t); + t = SWAP_LE64(t); /* wbuffer is suitably aligned for this */ *(uint64_t *) (&ctx->wbuffer[64 - 8]) = t; } -- cgit v1.2.3