summaryrefslogtreecommitdiff
path: root/mshimark/mkshimark.c
diff options
context:
space:
mode:
Diffstat (limited to 'mshimark/mkshimark.c')
-rw-r--r--mshimark/mkshimark.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mshimark/mkshimark.c b/mshimark/mkshimark.c
new file mode 100644
index 0000000..eb82e1b
--- /dev/null
+++ b/mshimark/mkshimark.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+#include <openssl/md5.h>
+//32 characters
+int main (int arc, char * argv[]) {
+ MD5_CTX c;
+ char md5buffer[512];
+ int bytesread;
+ printf("Put something in the stdin of the program and it will generate a random block of text\n");
+ unsigned char md5result[16];
+ MD5_Init(&c);
+ do {
+ bytesread = fread(md5buffer, sizeof(char), 512, stdin);
+ if (bytesread < 0) {
+ printf("Error reading from STDIN\n");
+ return -1;
+ }
+ MD5_Update(&c, md5buffer, bytesread);
+ } while (bytesread != 0);
+ MD5_Final(md5result, &c);
+ printf("\n");
+ int i = 0;
+ while ( i < (16) ) {
+ printf("%.2x",md5result[i]);
+ i++;
+ }
+ printf("\n");
+ return 0;
+}