当前位置:网站首页>[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 函数/存储过程定义
- Gbase 8C system table PG_ amop
- JS的装箱和拆箱
- Gbase 8C function / stored procedure parameters (II)
- Summary of interview project technology stack
- 二维格式数组格式索引下标连续问题导致 返回json 格式问题
- 《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
- Gbase 8C system table PG_ constraint
猜你喜欢
Today, it's time to copy the bottom!
Build a private cloud disk cloudrev
【ROS进阶篇】第六讲 ROS中的录制与回放(rosbag)
Kubernetes cluster log and efk architecture log scheme
Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers
怎么将yolov5中的PANet层改为BiFPN
The data in servlet is transferred to JSP page, and the problem cannot be displayed using El expression ${}
easyExcel
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
Baidu map - surrounding search
随机推荐
Principle and application of database
Wechat - developed by wechat official account Net core access
Hcip137-147 title + analysis
Add MDF database file to SQL Server database, and the error is reported
Gbase 8C trigger (I)
Monitoring and management of JVM
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
Cvpr2022 remove rain and fog
《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
Classes and objects - initialization and cleanup of objects - constructor call rules
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
Source code analysis | layout file loading process
Counter统计数量后,如何返回有序的key
【翻译】后台项目加入了CNCF孵化器
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
Error when installing MySQL in Linux: starting mysql The server quit without updating PID file ([FAILED]al/mysql/data/l.pid
sql server数据库添加 mdf数据库文件,遇到的报错
二维格式数组格式索引下标连续问题导致 返回json 格式问题
Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
javeScript 0.1 + 0.2 == 0.3的问题