From cc83d5eb50869a6168be5c3b45a449fa2a5d2c97 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 26 May 2012 13:53:45 -0500 Subject: [PATCH] SHA1 minor fixes --- README | 4 ---- src/sha1.c | 13 ++----------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/README b/README index 1ed9e23e..8e7f4542 100644 --- a/README +++ b/README @@ -161,10 +161,6 @@ originally based on code written by Matthew Russotto (www.russotto.net/chm/). lz.c, the code to find LZ77 matches, is based on code from zlib. -sha1.c and sha1.h, the code to compute SHA1 message digests of WIM resources or -of the WIM file itself in the case of integrity checks, are based on code from -GNU coreutils. - A very limited number of other free programs can handle some parts of the WIM file format. 7-zip is able to extract and create WIMs and files in many other archive formats. However, WIMLIB is designed specifically to handle WIM files diff --git a/src/sha1.c b/src/sha1.c index dd2dd249..cc92ae1c 100644 --- a/src/sha1.c +++ b/src/sha1.c @@ -201,14 +201,6 @@ static void sha1_final(u8 *md, SHA_CTX* context) for (i = 0; i < SHA1_HASH_SIZE; i++) { md[i] = (u8)((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); } - - i = 0; - memset(context->buffer, 0, 64); - memset(context->state, 0, 20); - memset(context->count, 0, 8); - memset(finalcount, 0, 8); /* SWR */ - - sha1_transform(context->state, context->buffer); } void sha1_buffer(const void *buffer, size_t len, void *md) @@ -241,9 +233,8 @@ static int sha1_stream(FILE *fp, void *md) } -/* Calculates the SHA1 message digest given the name of a file. - * @buf must point to a buffer of length 20 bytes into which the message digest - * is written. +/* Calculates the SHA1 message digest given the name of a file. @md must point + * to a buffer of length 20 bytes into which the message digest is written. */ int sha1sum(const char *filename, void *md) { -- 2.43.0