md5从16字节转换为32字节

## md5从16字节转换为32字节
16字节到32字节的转换,实际上是通过将每个字节输出成十六进制数据的来的,所以通过一下函数实现。
```c
#include <stdio.h>


void md5_short_to_long(char *md5_long, char *md5_short)
{
    int i = 0;
    char *p_md5_long = md5_long;
    for(i = 0; i < MD5_SHORT; i++){
        p_md5_long += sprintf(p_md5_long,"%2x",md5_short[i]);
    }
        printf("fun long md5:%s\n",md5_long);
}

void main()
{
        char md5_short[17] = { "0123456789abcdef"};
        char md5_long[33] = {0};
        
        md5_short_to_long(md5_long, md5_short);
        printf("long md5:%s\n",md5_long);
        
        
}

```

猜你喜欢

转载自blog.csdn.net/G_Super_Mouse/article/details/112913624