S
Serman D.
Hi,
I have very limited C knowledge. I want to convert to output from a
MD5 hash algorithm to printable ascii similar to the output of the
md5sum in GNU coreutils. Any help on how to do the conversion is
appreciated.
[aff@afflinux md5_xyssl]$ gcc -o test test.c md5.c
[aff@afflinux md5_xyssl]$ ./test
"J?n??CBW? ?}"
[aff@afflinux md5_xyssl]$ echo "This is my dearest secret: 12345" |
md5sum
749226c29c17114562745d9769fdab45 -
[aff@afflinux md5_xyssl]$
$ md5sum --version
md5sum (coreutils) 5.2.1
/*
* test.c
*
* MD5 source from http://xyssl.org/code/source/md5/
*
*/
#include "md5.h"
#include <string.h>
int main (void) {
unsigned char in[64] = "This is my dearest secret: 12345";
unsigned char *pout;
// compute MD5 hash
md5_csum(in, 64, pout);
printf("\"%s\"\n", pout);
}
I have very limited C knowledge. I want to convert to output from a
MD5 hash algorithm to printable ascii similar to the output of the
md5sum in GNU coreutils. Any help on how to do the conversion is
appreciated.
[aff@afflinux md5_xyssl]$ gcc -o test test.c md5.c
[aff@afflinux md5_xyssl]$ ./test
"J?n??CBW? ?}"
[aff@afflinux md5_xyssl]$ echo "This is my dearest secret: 12345" |
md5sum
749226c29c17114562745d9769fdab45 -
[aff@afflinux md5_xyssl]$
$ md5sum --version
md5sum (coreutils) 5.2.1
/*
* test.c
*
* MD5 source from http://xyssl.org/code/source/md5/
*
*/
#include "md5.h"
#include <string.h>
int main (void) {
unsigned char in[64] = "This is my dearest secret: 12345";
unsigned char *pout;
// compute MD5 hash
md5_csum(in, 64, pout);
printf("\"%s\"\n", pout);
}