diff options
author | Haoran S. Diao <0@hairydiode.xyz> | 2019-02-11 18:29:50 -0500 |
---|---|---|
committer | Haoran S. Diao <0@hairydiode.xyz> | 2019-02-11 18:29:50 -0500 |
commit | a8afc7cb94b5ffea7cdabdc42ef1df3314770e02 (patch) | |
tree | a1c9630fa0e673b522420e23f652f7fa8893a958 /mshimark |
Diffstat (limited to 'mshimark')
-rw-r--r-- | mshimark/Makefile | 4 | ||||
-rwxr-xr-x | mshimark/mkshimark | bin | 0 -> 17000 bytes | |||
-rw-r--r-- | mshimark/mkshimark.c | 29 |
3 files changed, 33 insertions, 0 deletions
diff --git a/mshimark/Makefile b/mshimark/Makefile new file mode 100644 index 0000000..806e1cd --- /dev/null +++ b/mshimark/Makefile @@ -0,0 +1,4 @@ +mkshimark: mkshimark.c + gcc mkshimark.c -lssl -lcrypto -o mkshimark +clean: + rm mkshimark diff --git a/mshimark/mkshimark b/mshimark/mkshimark Binary files differnew file mode 100755 index 0000000..be134b5 --- /dev/null +++ b/mshimark/mkshimark 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; +} |