问题描述
我的C知识非常有限。我想将
MD5哈希算法的输出转换为可打印的ascii,类似于GNU coreutils中
md5sum的输出。任何关于如何进行转换的帮助都是值得赞赏的。
[aff @ afflinux md5_xyssl] $ gcc -o test test.c md5.c
[aff @ afflinux md5_xyssl] $ ./test
" J?n ?? CBW? ?}"
[aff @ afflinux md5_xyssl] $ echo"这是我最亲密的秘密:12345" |
md5sum
749226c29c17114562745d9769fdab45 -
[aff @ afflinux md5_xyssl] $
$ md5sum - -version
md5sum(coreutils)5.2.1
/ *
* test.c
*
*来自
*
* /
#include" md5。 h"
#include< string.h>
int main(void){
unsigned char in [64] ="这是我最亲密的秘密:12345";
unsigned char * pout;
//计算MD5哈希
md5_csum(in,64,pout);
printf(" \"%s \" \ n",pout);
}
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);
}
推荐答案
这篇关于将输出从MD5转换为可打印的ascii的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!