当前位置:网站首页>[C语言]给账号密码进行MD5加密
[C语言]给账号密码进行MD5加密
2022-07-03 02:42:00 【I&You】
源码解析
//md5加密用户密码
UtlMd5_t ctx;
unsigned char serverDigest[16];
utl_md5_init(&ctx);
//md5初始化
utl_md5_update(&ctx, "admin", strlen("admin"));
//将要加密的信息传递给初始化过的MD5结构体,无返回值
//穿账号
utl_md5_update(&ctx, "debug_get_vs_status", strlen("debug_get_vs_status"));
//传控制指令
utl_md5_update(&ctx, "admin123", strlen("admin123"));
//传密码
utl_md5_final(&ctx, serverDigest);
//转换成32位的16进制字符串
int i=0;
unsigned char decrypt32[64]={
0};
char temp[8]={
0};
for(i=0;i<16;i++)
{
sprintf(temp,"%02x",serverDigest[i]);//把十六进制转换成字符串%x=0x6b ==> %s="6b"
strcat((char *)decrypt32,temp);
}
//最后生成的decrypt32即为md5加密密码:"6be7c69c5cdf177753270cf390ef1e90"
//成功发送
/*
Content-Length: 133
Content-Type: application/json;charset=utf-8
Connection: close
{
"method": "debug_get_vs_status",
"param": {
},
"user": {
"name": "admin",
"digest": "6be7c69c5cdf177753270cf390ef1e90"
}
} 发送成功 长度 251!
响应报文头部:
*******************************
HTTP/1.1 200 OK
Content-Length: 1640
Content-Type: application/json;charset=utf-8
Connection: close
*/
源码下载
边栏推荐
- The solution of "the required function is not supported" in win10 remote desktop connection is to modify the Registry [easy to understand]
- Gbase 8C system table PG_ collation
- 【翻译】后台项目加入了CNCF孵化器
- Informatics Olympiad one general question bank 1006 a+b questions
- SQL server queries the table structure of the specified table
- Serious security vulnerabilities reported by moxa mxview network management software
- HTB-Devel
- MUX VLAN Foundation
- [translation] the background project has joined the CNCF incubator
- Kubernetes family container housekeeper pod online Q & A?
猜你喜欢

搭建私有云盘 cloudreve
![[translation] modern application load balancing with centralized control plane](/img/b0/22e9bf098d580b2af67255ddcdc0d5.jpg)
[translation] modern application load balancing with centralized control plane

【翻译】具有集中控制平面的现代应用负载平衡

【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)

Tongda OA V12 process center

4. Classes and objects
![[Hcia]No.15 Vlan间通信](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[Hcia]No.15 Vlan间通信

Xiaodi notes

基于can总线的A2L文件解析(2)

A2L file parsing based on CAN bus (2)
随机推荐
【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
The Linux server needs to install the agent software EPS (agent) database
[translation] flux is safe. Gain more confidence through fuzzy processing
Serious security vulnerabilities reported by moxa mxview network management software
[fluent] futurebuilder asynchronous programming (futurebuilder construction method | asyncsnapshot asynchronous calculation)
Source code analysis | layout file loading process
Memory pool (understand the process of new developing space from the perspective of kernel)
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
C语言中左值和右值的区别
SQL Server Query spécifie la structure de la table
How to change the panet layer in yolov5 to bifpn
Build a private cloud disk cloudrev
超好用的日志库 logzero
As a leader, how to control the code version and demand development when the epidemic comes| Community essay solicitation
HTB-Devel
GBase 8c系统表-pg_authid
Cancer biopsy instruments and kits - market status and future development trends
GBase 8c 函数/存储过程参数(二)
Source code analysis | resource loading resources
Choose it when you decide