X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/aabf2c1bd3e37fb70b674dba243f927069909534..b7a8b5277d37b289361ff0cc881632f527e4d5db:/md5.h?ds=sidebyside diff --git a/md5.h b/md5.h index 57eba21..92f45db 100644 --- a/md5.h +++ b/md5.h @@ -22,21 +22,21 @@ #define _MD5_H 1 #include +#include #include -typedef u_int32_t md5_uint32; typedef size_t md5_uintptr; /* Structure to save state of computation between the single steps. */ struct md5_ctx { char buffer[128]; - md5_uint32 A; - md5_uint32 B; - md5_uint32 C; - md5_uint32 D; + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; - md5_uint32 total[2]; - md5_uint32 buflen; + uint32_t total[2]; + uint32_t buflen; }; /* @@ -46,21 +46,14 @@ struct md5_ctx /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ -extern void md5_init_ctx (struct md5_ctx *ctx); - -/* Starting with the result of former calls of this function (or the - initialization function update the context for the next LEN bytes - starting at BUFFER. - It is necessary that LEN is a multiple of 64!!! */ -extern void md5_process_block (const void *buffer, size_t len, - struct md5_ctx *ctx); +extern void md5_init(struct md5_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ -extern void md5_process_bytes (const void *buffer, size_t len, - struct md5_ctx *ctx); +extern void md5_update(struct md5_ctx *ctx, unsigned length, + const uint8_t *buffer); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little @@ -69,28 +62,6 @@ extern void md5_process_bytes (const void *buffer, size_t len, IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); - - -/* Put result from CTX in first 16 bytes following RESBUF. The result is - always in little endian byte order, so that a byte-wise output yields - to the wanted ASCII representation of the message digest. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); - - -/* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -extern int md5_stream (FILE *stream, void *resblock); - -/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise - output yields to the wanted ASCII representation of the message - digest. */ -extern void *md5_buffer (const char *buffer, size_t len, - void *resblock); +extern void md5_digest(struct md5_ctx *ctx, unsigned length, uint8_t *resbuf); #endif /* md5.h */