Skip to content

Commit

Permalink
block-sha1: undo ctx->size change
Browse files Browse the repository at this point in the history
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 <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Aug 6, 2009
1 parent d7c208a commit b26a9d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions block-sha1/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *data, unsigned long len)
{
int lenW = ctx->lenW;

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

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

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

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

0 comments on commit b26a9d5

Please sign in to comment.