Add crypt.[ch] and update md5sum and sha1sum
Factor out the code from md5sum and sha1sum into a util function. Use FILE * instead of a file descriptor. This will make it a bit easier/more consistent when we implement support for the -c option.
This commit is contained in:
6
sha1.h
6
sha1.h
@@ -9,10 +9,10 @@ struct sha1 {
|
||||
enum { SHA1_DIGEST_LENGTH = 20 };
|
||||
|
||||
/* reset state */
|
||||
void sha1_init(struct sha1 *s);
|
||||
void sha1_init(void *ctx);
|
||||
/* process message */
|
||||
void sha1_update(struct sha1 *s, const void *m, unsigned long len);
|
||||
void sha1_update(void *ctx, const void *m, unsigned long len);
|
||||
/* get message digest */
|
||||
/* state is ruined after sum, keep a copy if multiple sum is needed */
|
||||
/* part of the message might be left in s, zero it if secrecy is needed */
|
||||
void sha1_sum(struct sha1 *s, uint8_t md[SHA1_DIGEST_LENGTH]);
|
||||
void sha1_sum(void *ctx, uint8_t md[SHA1_DIGEST_LENGTH]);
|
||||
|
Reference in New Issue
Block a user