diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-12 17:50:50 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-12 17:50:50 +0000 |
commit | 4a43057268a29c613f5482e6795a0a8ead9974ef (patch) | |
tree | 64b51d22424f4dc21b5dd66a5b148c508625a70d | |
parent | ddb1b85053da8405e661db762c59406da6cb8476 (diff) | |
download | busybox-w32-4a43057268a29c613f5482e6795a0a8ead9974ef.tar.gz busybox-w32-4a43057268a29c613f5482e6795a0a8ead9974ef.tar.bz2 busybox-w32-4a43057268a29c613f5482e6795a0a8ead9974ef.zip |
sha: tiny shrink
-rw-r--r-- | libbb/sha1.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libbb/sha1.c b/libbb/sha1.c index 745ac693c..765fedd9b 100644 --- a/libbb/sha1.c +++ b/libbb/sha1.c | |||
@@ -54,13 +54,12 @@ static inline uint64_t hton64(uint64_t v) | |||
54 | 54 | ||
55 | 55 | ||
56 | #define SHA1_BLOCK_SIZE 64 | 56 | #define SHA1_BLOCK_SIZE 64 |
57 | #define SHA1_DIGEST_SIZE 20 | ||
58 | #define SHA1_HASH_SIZE SHA1_DIGEST_SIZE | ||
59 | #define SHA1_MASK (SHA1_BLOCK_SIZE - 1) | 57 | #define SHA1_MASK (SHA1_BLOCK_SIZE - 1) |
60 | 58 | ||
61 | static void sha1_process_block64(sha1_ctx_t *ctx) | 59 | static void sha1_process_block64(sha1_ctx_t *ctx) |
62 | { | 60 | { |
63 | uint32_t w[80], i, a, b, c, d, e, t; | 61 | unsigned i; |
62 | uint32_t w[80], a, b, c, d, e, t; | ||
64 | 63 | ||
65 | /* note that words are compiled from the buffer into 32-bit */ | 64 | /* note that words are compiled from the buffer into 32-bit */ |
66 | /* words in big-endian order so an order reversal is needed */ | 65 | /* words in big-endian order so an order reversal is needed */ |
@@ -94,13 +93,13 @@ static void sha1_process_block64(sha1_ctx_t *ctx) | |||
94 | for (i = 0; i < 20; ++i) | 93 | for (i = 0; i < 20; ++i) |
95 | rnd(ch, 0x5a827999); | 94 | rnd(ch, 0x5a827999); |
96 | 95 | ||
97 | for (i = 20; i < 40; ++i) | 96 | for (/*i = 20*/; i < 40; ++i) |
98 | rnd(parity, 0x6ed9eba1); | 97 | rnd(parity, 0x6ed9eba1); |
99 | 98 | ||
100 | for (i = 40; i < 60; ++i) | 99 | for (/*i = 40*/; i < 60; ++i) |
101 | rnd(maj, 0x8f1bbcdc); | 100 | rnd(maj, 0x8f1bbcdc); |
102 | 101 | ||
103 | for (i = 60; i < 80; ++i) | 102 | for (/*i = 60*/; i < 80; ++i) |
104 | rnd(parity, 0xca62c1d6); | 103 | rnd(parity, 0xca62c1d6); |
105 | #undef ch | 104 | #undef ch |
106 | #undef parity | 105 | #undef parity |
@@ -392,8 +391,6 @@ void FAST_FUNC sha512_begin(sha512_ctx_t *ctx) | |||
392 | } | 391 | } |
393 | 392 | ||
394 | 393 | ||
395 | /* SHA1 hash data in an array of bytes into hash buffer and call the */ | ||
396 | /* hash_compile function as required. */ | ||
397 | void FAST_FUNC sha1_hash(const void *buffer, size_t len, sha1_ctx_t *ctx) | 394 | void FAST_FUNC sha1_hash(const void *buffer, size_t len, sha1_ctx_t *ctx) |
398 | { | 395 | { |
399 | unsigned in_buf = ctx->total64 & SHA1_MASK; | 396 | unsigned in_buf = ctx->total64 & SHA1_MASK; |