From 5cf7c2df668d25c41a05670edd08558226f0bfdf Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 21 Feb 2006 06:44:43 +0000 Subject: Patch from Devin Bayer to split up hash_fd.c into md5.c and sha1.c. (I tweaked md5_sha1_sum.c to convert some #ifdef CONFIG to if(ENABLE).) --- include/libbb.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'include/libbb.h') diff --git a/include/libbb.h b/include/libbb.h index 9f0c85b03..0ede812a9 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -464,9 +464,29 @@ extern void vfork_daemon_rexec(int nochdir, int noclose, extern int get_terminal_width_height(int fd, int *width, int *height); extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *)); -#define HASH_SHA1 1 -#define HASH_MD5 2 -extern int hash_fd(int fd, const size_t size, const uint8_t hash_algo, uint8_t *hashval); +typedef struct _sha1_ctx_t_ { + uint32_t count[2]; + uint32_t hash[5]; + uint32_t wbuf[16]; +} sha1_ctx_t; + +void sha1_begin(sha1_ctx_t *ctx); +void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx); +void *sha1_end(void *resbuf, sha1_ctx_t *ctx); + +typedef struct _md5_ctx_t_ { + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; + uint32_t total[2]; + uint32_t buflen; + char buffer[128]; +} md5_ctx_t; + +void md5_begin(md5_ctx_t *ctx); +void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); +void *md5_end(void *resbuf, md5_ctx_t *ctx); /* busybox.h will include dmalloc later for us, else include it here. */ #if !defined _BB_INTERNAL_H_ && defined DMALLOC -- cgit v1.2.3