当前位置:网站首页>[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
*/
源码下载
边栏推荐
- tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
- "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
- Informatics Olympiad one general question bank 1006 a+b questions
- random shuffle注意
- GBase 8c系统表-pg_auth_members
- 【翻译】后台项目加入了CNCF孵化器
- Two dimensional format array format index subscript continuity problem leads to return JSON format problem
- Random Shuffle attention
- What does "where 1=1" mean
- 当lambda没有输入时,是何含义?
猜你喜欢
Mathematical statistics -- Sampling and sampling distribution
Matlab tips (24) RBF, GRNN, PNN neural network
Basic operation of binary tree (C language version)
基于can总线的A2L文件解析(2)
Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution
4. Classes and objects
【ROS进阶篇】第六讲 ROS中的录制与回放(rosbag)
SQL statement
Choose it when you decide
HTB-Devel
随机推荐
[translation] modern application load balancing with centralized control plane
Xiaodi notes
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
QT qcombobox add qccheckbox (drop-down list box insert check box, including source code + comments)
Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque
【教程】chrome关闭跨域策略cors、samesite,跨域带上cookie
Gbase 8C system table PG_ constraint
Linear rectification function relu and its variants in deep learning activation function
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_ cast
easyExcel
HW initial preparation
Error when installing MySQL in Linux: starting mysql The server quit without updating PID file ([FAILED]al/mysql/data/l.pid
Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
random shuffle注意
JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
[tutorial] chrome turns off cross domain policies CORS and samesite, and brings cookies across domains
左值右指解释的比较好的
Choose it when you decide