diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-12 19:06:18 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-12 19:06:18 +0000 |
commit | c8329c956816656364e54d54932c5898a29bed70 (patch) | |
tree | 82f055e1ef31d209bd5d5c16bd09be6ed6071552 /include | |
parent | 4a43057268a29c613f5482e6795a0a8ead9974ef (diff) | |
download | busybox-w32-c8329c956816656364e54d54932c5898a29bed70.tar.gz busybox-w32-c8329c956816656364e54d54932c5898a29bed70.tar.bz2 busybox-w32-c8329c956816656364e54d54932c5898a29bed70.zip |
sha: reduce sha256/512 context size. Make sha1/sha256 code more similar
function old new delta
sha512_end 182 204 +22
sha256_end 137 147 +10
sha1_hash 113 108 -5
sha1_end 143 129 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 32/-19) Total: 13 bytes
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 3f566f8af..b04488a54 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1322,7 +1322,7 @@ void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_F | |||
1322 | 1322 | ||
1323 | typedef struct sha1_ctx_t { | 1323 | typedef struct sha1_ctx_t { |
1324 | uint64_t total64; | 1324 | uint64_t total64; |
1325 | uint32_t wbuffer[16]; /* NB: always correctly aligned for uint64_t */ | 1325 | uint8_t wbuffer[64]; /* NB: always correctly aligned for uint64_t */ |
1326 | uint32_t hash[5]; | 1326 | uint32_t hash[5]; |
1327 | } sha1_ctx_t; | 1327 | } sha1_ctx_t; |
1328 | void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; | 1328 | void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; |
@@ -1331,7 +1331,7 @@ void sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC; | |||
1331 | typedef struct sha256_ctx_t { | 1331 | typedef struct sha256_ctx_t { |
1332 | uint64_t total64; | 1332 | uint64_t total64; |
1333 | uint32_t hash[8]; | 1333 | uint32_t hash[8]; |
1334 | char wbuffer[64*2]; /* NB: always correctly aligned for uint64_t */ | 1334 | uint8_t wbuffer[64]; /* NB: always correctly aligned for uint64_t */ |
1335 | } sha256_ctx_t; | 1335 | } sha256_ctx_t; |
1336 | void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; | 1336 | void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; |
1337 | void sha256_hash(const void *buffer, size_t len, sha256_ctx_t *ctx) FAST_FUNC; | 1337 | void sha256_hash(const void *buffer, size_t len, sha256_ctx_t *ctx) FAST_FUNC; |
@@ -1339,7 +1339,7 @@ void sha256_end(void *resbuf, sha256_ctx_t *ctx) FAST_FUNC; | |||
1339 | typedef struct sha512_ctx_t { | 1339 | typedef struct sha512_ctx_t { |
1340 | uint64_t total64[2]; | 1340 | uint64_t total64[2]; |
1341 | uint64_t hash[8]; | 1341 | uint64_t hash[8]; |
1342 | char wbuffer[128*2]; /* NB: always correctly aligned for uint64_t */ | 1342 | uint8_t wbuffer[128]; /* NB: always correctly aligned for uint64_t */ |
1343 | } sha512_ctx_t; | 1343 | } sha512_ctx_t; |
1344 | void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; | 1344 | void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; |
1345 | void sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx) FAST_FUNC; | 1345 | void sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx) FAST_FUNC; |