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).)
This commit is contained in:
Rob Landley
2006-02-21 06:44:43 +00:00
parent a7e3d05208
commit 5cf7c2df66
8 changed files with 358 additions and 427 deletions

View File

@ -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