当前位置:网站首页>[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
*/
源码下载
边栏推荐
- GBase 8c 函数/存储过程参数(二)
- Gbase 8C system table PG_ auth_ members
- Gbase 8C function / stored procedure parameters (II)
- Gbase 8C system table PG_ attribute
- 【教程】chrome关闭跨域策略cors、samesite,跨域带上cookie
- Check log4j problems using stain analysis
- easyExcel
- random shuffle注意
- sql server数据库添加 mdf数据库文件,遇到的报错
- 基于can总线的A2L文件解析(2)
猜你喜欢

easyExcel

Your family must be very poor if you fight like this!

"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b

easyPOI

Principle and application of database

Add MDF database file to SQL Server database, and the error is reported

Check log4j problems using stain analysis

Tongda OA homepage portal workbench

SqlServer行转列PIVOT
![[Hcia]No.15 Vlan间通信](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[Hcia]No.15 Vlan间通信
随机推荐
HTB-Devel
The Linux server needs to install the agent software EPS (agent) database
Cancer biopsy instruments and kits - market status and future development trends
5. File operation
Word word word
What does "where 1=1" mean
Today, it's time to copy the bottom!
【ROS进阶篇】第六讲 ROS中的录制与回放(rosbag)
Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???
where 1=1 是什么意思
Practice of traffic recording and playback in vivo
[hcia]no.15 communication between VLANs
Baidu map - surrounding search
【翻译】具有集中控制平面的现代应用负载平衡
tensor中的append应该如何实现
SQL Server Query spécifie la structure de la table
random shuffle注意
GBase 8c触发器(三)
GBase 8c系统表-pg_conversion
Gbase 8C trigger (II)