]> git.neil.brown.name Git - edlib.git/blob - md5test.c
TODO: clean out done items.
[edlib.git] / md5test.c
1 #include <unistd.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include "md5.h"
5
6 int main(int argc, char *argv[])
7 {
8         struct md5_state ctx;
9         char buf[8192];
10         int n;
11         uint8_t out[MD5_DIGEST_SIZE];
12
13         md5_init(&ctx);
14
15         while ((n = read(0, buf, sizeof(buf))) > 0)
16                 md5_update(&ctx, buf, n);
17         md5_final(&ctx, out);
18
19         for (n = 0; n < MD5_DIGEST_SIZE; n++)
20                 printf("%02x", out[n]);
21         printf("\n");
22         exit(0);
23 }