Skip to content

Commit b26a9d5

Browse files
committed
block-sha1: undo ctx->size change
Undo the change I picked up from the mailing list discussion suggested by Nico, not because it is wrong, but it will be done at the end of the follow-up series. Signed-off-by: Junio C Hamano <[email protected]>
1 parent d7c208a commit b26a9d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

block-sha1/sha1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *data, unsigned long len)
3131
{
3232
int lenW = ctx->lenW;
3333

34-
ctx->size += len;
34+
ctx->size += (unsigned long long) len << 3;
3535

3636
/* Read the data into W and process blocks as they get full
3737
*/
@@ -68,8 +68,8 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
6868

6969
/* Pad with a binary 1 (ie 0x80), then zeroes, then length
7070
*/
71-
padlen[0] = htonl(ctx->size >> (32 - 3));
72-
padlen[1] = htonl(ctx->size << 3);
71+
padlen[0] = htonl(ctx->size >> 32);
72+
padlen[1] = htonl(ctx->size);
7373

7474
blk_SHA1_Update(ctx, pad, 1+ (63 & (55 - ctx->lenW)));
7575
blk_SHA1_Update(ctx, padlen, 8);

0 commit comments

Comments
 (0)