summaryrefslogtreecommitdiffstats
path: root/tests/helpers/test_md5.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/helpers/test_md5.c')
-rw-r--r--tests/helpers/test_md5.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/helpers/test_md5.c b/tests/helpers/test_md5.c
new file mode 100644
index 000000000..b99882b53
--- /dev/null
+++ b/tests/helpers/test_md5.c
@@ -0,0 +1,30 @@
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include "md5.h"
+
+int
+main(int argc, char *argv[])
+{
+ int i, ret;
+ struct MD5Context ctx;
+ unsigned char digest[16];
+ unsigned char buf[BUFSIZ];
+
+ MD5Init( &ctx );
+
+ while(!feof(stdin) && !ferror(stdin)) {
+ ret = fread(buf, 1, sizeof(buf), stdin);
+ if (ret)
+ MD5Update( &ctx, buf, ret );
+ }
+
+ fclose(stdin);
+ MD5Final( digest, &ctx );
+
+ for (i = 0; i < 16; i++)
+ printf( "%02x", digest[i] );
+ printf(" -\n");
+ return 0;
+}