#include <string.h>
#include "md5.h"
#ifndef WORDS_BIGENDIAN
#define byteReverse(buf, len) /* Nothing */
#else
static void byteReverse(unsigned char *buf, unsigned longs);
/*
* Note: this code is harmless on little-endian machines.
*/
static void byteReverse(unsigned char *buf, unsigned longs)
{
word32 t;
do {
t = (word32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(word32 *) buf = t;
buf += 4;
} while (--longs);
}
#endif
/*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
void MD5Init(struct MD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
{
register word32 t;
/* Update bitcount */
t = ctx->bits[0];
if ((ctx->bits[0] = t + ((word32) len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */
if (t) {
unsigned char *p = (unsigned char *) ctx->in + t;
t = 64 - t;
if (len < t) {
memmove(p, buf, len);
return;
}
memmove(p, buf, t);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (word32 *) ctx->in);
buf += t;
len -= t;
}
/* Process data in 64-byte chunks */
while (len >= 64) {
memmove(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (word32 *) ctx->in);
buf += 64;
len -= 64;
}
/* Handle any remaining bytes of data. */
memmove(ctx->in, buf, len);
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
{
unsigned int count;
unsigned char *p;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = ctx->in + count;
*p++ = 0x80;
/* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (word32 *) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
} else {
/* Pad block to 56 bytes */
memset(p, 0, count - 8);
}
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
((word32 *) ctx->in)[14] = ctx->bits[0];
((word32 *) ctx->in)[15] = ctx->bits[1];
MD5Transform(ctx->buf, (word32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memmove(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */
/* #define F1(x, y, z) (x & y | ~x & z) */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
void MD5Transform(word32 buf[4], word32 const in[16])
{
register word32 a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}
char* crypt_md5(const char* pw, const char* salt)
{
static char *magic = "$1$"; /*
* This string is magic for
* this algorithm. Having
* it this way, we can get
* get better later on
*/
static char passwd[120], *p;
static const char *sp,*ep;
unsigned char final[MD5_SIZE];
int sl,pl,i;
MD5_CTX ctx,ctx1;
unsigned long l;
/* Refine the Salt first */
sp = salt;
/* If it star
没有合适的资源?快使用搜索试试~ 我知道了~
directui 源码
共263个文件
h:87个
bmp:73个
png:34个
4星 · 超过85%的资源 需积分: 18 76 下载量 138 浏览量
2011-09-24
12:04:16
上传
评论
收藏 6.63MB ZIP 举报
温馨提示
基于金山卫士的界面源码,整理过. 采用C++,见过的最好的界面框架,实用
资源推荐
资源详情
资源评论
收起资源包目录
directui 源码 (263个子文件)
beikesafe.aps 4KB
bkres.aps 1KB
version.aps 1KB
bg_login.bmp 2.21MB
bg.bmp 281KB
ringing.bmp 95KB
free - Copy.bmp 44KB
tab_main.bmp 44KB
call.bmp 26KB
exam_status_icon.bmp 8KB
mainui_bws_icon.bmp 6KB
exam_title_icon.bmp 6KB
exam_right_btn_bg.bmp 5KB
main_bg_body.bmp 4KB
listitems.bmp 4KB
btn_virscan_bg.bmp 3KB
btn_sys_close.bmp 3KB
softdlg_border.bmp 3KB
login_bg_body.bmp 2KB
listctrl_check.bmp 2KB
tab_normal.bmp 2KB
install_softmgr.bmp 2KB
tab_normal_ex.bmp 2KB
listctrl_check2.bmp 2KB
downdetail_softmgr.bmp 1KB
kws_listctrl_check.bmp 1KB
listctrl_radio.bmp 1KB
msgbox_bg.bmp 1KB
icon_detail_softmgr.bmp 1KB
soft_onkey_insting_bg.bmp 1KB
softdlg_top.bmp 950B
icon_flash.bmp 824B
ad_filter_set.bmp 824B
kwsmain_icon.bmp 822B
clear_panel.bmp 776B
loaddlg_panel.bmp 776B
expand.bmp 774B
collapse.bmp 774B
exam_line.bmp 768B
soft_onkey_seldir_bg_sanjiao.bmp 714B
main_bg_header.bmp 608B
soft_onkey_seldir_bg.bmp 602B
clear_bk.bmp 582B
xzbh_09.bmp 576B
detail_header.bmp 574B
btn_tab.bmp 560B
kwsdlg_bg.bmp 488B
plug_list_header.bmp 456B
listctrl_header.bmp 454B
listctrl_header2.bmp 454B
exam_title_bg.bmp 452B
exam_title_bg_only.bmp 436B
loadinfo_dlgbk.bmp 424B
main_bg_footer.bmp 424B
progress_bar_bg.bmp 416B
soft_onkey_insting_bg_sanjiao.bmp 406B
open_dls_page.bmp 384B
progress_bar_value_red.bmp 320B
progress_bar_value.bmp 320B
runopt_listheader.bmp 296B
minus_plus.bmp 272B
icon_protection.bmp 246B
listctrl_header_arrow_down.bmp 246B
listctrl_header_arrow_up.bmp 246B
vul_Detail.bmp 192B
splitter_arrow.bmp 176B
scan_result_list_bar_sel.bmp 170B
softdlg_btm.bmp 162B
progress_bottom.bmp 150B
arrow.bmp 124B
msgbox_body_bg.bmp 104B
exam_bg.bmp 96B
frame_panel_gray.bmp 92B
progress_value.bmp 86B
frame_panel - 副本.bmp 84B
frame_panel.bmp 84B
md5.c 10KB
tinyxmlparser.cpp 36KB
tinyxml.cpp 36KB
winpath.cpp 36KB
ListViewCtrlEx.cpp 28KB
msgbox.cpp 12KB
beikesafe.cpp 8KB
maindlg.cpp 4KB
logindlg.cpp 4KB
tinystr.cpp 3KB
RichEditCtrlEx.cpp 2KB
tinyxmlerror.cpp 2KB
shandian_utility.cpp 1KB
stdafx.cpp 956B
registrywow.cpp 73B
atlctrls.h 265KB
bkwinres.h 178KB
atldlgs.h 169KB
atlctrlx.h 126KB
atlctrlw.h 119KB
atlframe.h 100KB
atlgdi.h 98KB
RegularExpress.h 95KB
atlmisc.h 94KB
共 263 条
- 1
- 2
- 3
youzhengxian
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 同等学力申硕考试 组合数学
- 同等学力 离散数学与组合数学
- 50条最常用Linux系统命令大全手册
- 斯沃数控仿真软件7.2版数控加工中心车床铣床编程仿真模拟教程斯沃系统手册可编程序控制器系统(ABPLC)说明
- 2023NOC软件创意编程赛项真题-python小高初赛
- 2024安全信息安全与评估
- 斯沃数控仿真软件7.2版数控加工中心车床铣床编程仿真模拟教程斯沃系统手册DASEN-9i-连接手册PLC-手册
- SpringBoot集成MyBatis-Plus
- 基于python-contrib-opencv,dlib,pyqt5实现电脑端摄像头读取视频,实时人脸录入,人脸识别等功能
- 斯沃数控仿真软件7.2版数控加工中心车床铣床编程仿真模拟教程斯沃系统手册DASEN-3i-h连接手册PLC手册
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页