diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/include/libbb.h b/include/libbb.h index c161ed7e2..3c8764b5c 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1515,35 +1515,14 @@ enum { }; void FAST_FUNC read_base64(FILE *src_stream, FILE *dst_stream, int flags); -typedef struct sha1_ctx_t { - uint32_t hash[8]; /* 5, +3 elements for sha256 */ - uint64_t total64; /* must be directly after hash[] */ - uint8_t wbuffer[64]; /* NB: always correctly aligned for uint64_t */ - void (*process_block)(struct sha1_ctx_t*) FAST_FUNC; -} sha1_ctx_t; -void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; -void sha1_hash(sha1_ctx_t *ctx, const void *data, size_t length) FAST_FUNC; -void sha1_end(sha1_ctx_t *ctx, void *resbuf) FAST_FUNC; -typedef struct sha1_ctx_t sha256_ctx_t; -void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; -#define sha256_hash sha1_hash -#define sha256_end sha1_end -typedef struct sha512_ctx_t { - uint64_t hash[8]; - uint64_t total64[2]; /* must be directly after hash[] */ - uint8_t wbuffer[128]; /* NB: always correctly aligned for uint64_t */ -} sha512_ctx_t; -void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; -void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; -void sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC; #if 1 typedef struct md5_ctx_t { + char wbuffer[64]; /* NB: always correctly aligned for uint64_t */ + uint64_t total64; uint32_t A; uint32_t B; uint32_t C; uint32_t D; - uint64_t total64; - char wbuffer[64]; /* NB: always correctly aligned for uint64_t */ } md5_ctx_t; #else /* libbb/md5prime.c uses a bit different one: */ @@ -1556,6 +1535,27 @@ typedef struct md5_ctx_t { void md5_begin(md5_ctx_t *ctx) FAST_FUNC; void md5_hash(md5_ctx_t *ctx, const void *data, size_t length) FAST_FUNC; void md5_end(md5_ctx_t *ctx, void *resbuf) FAST_FUNC; +typedef struct sha1_ctx_t { + uint8_t wbuffer[64]; /* NB: always correctly aligned for uint64_t */ + uint64_t total64; /* must be directly before hash[] */ + uint32_t hash[8]; /* 5, +3 elements for sha256 */ + void (*process_block)(struct sha1_ctx_t*) FAST_FUNC; +} sha1_ctx_t; +void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; +void sha1_hash(sha1_ctx_t *ctx, const void *data, size_t length) FAST_FUNC; +void sha1_end(sha1_ctx_t *ctx, void *resbuf) FAST_FUNC; +typedef struct sha1_ctx_t sha256_ctx_t; +void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; +#define sha256_hash sha1_hash +#define sha256_end sha1_end +typedef struct sha512_ctx_t { + uint64_t total64[2]; /* must be directly before hash[] */ + uint64_t hash[8]; + uint8_t wbuffer[128]; /* NB: always correctly aligned for uint64_t */ +} sha512_ctx_t; +void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; +void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; +void sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC; uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC; |