资源简介
基于vs2008开发的一个MFC文件MD5查看器,支持文件拖动到程序查看MD5,以及复制MD5值等功能,对于学习VC++有一定帮助。
代码片段和文件信息
#include “stdafx.h“
#include “md5.h“
using namespace std;
/* Constants for MD5Transform routine. */
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
/* F G H and I are basic MD5 functions.
*/
#define F(x y z) (((x) & (y)) | ((~x) & (z)))
#define G(x y z) (((x) & (z)) | ((y) & (~z)))
#define H(x y z) ((x) ^ (y) ^ (z))
#define I(x y z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF GG HH and II transformations for rounds 1 2 3 and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a b c d x s ac) { \
(a) += F ((b) (c) (d)) + (x) + ac; \
(a) = ROTATE_LEFT ((a) (s)); \
(a) += (b); \
}
#define GG(a b c d x s ac) { \
(a) += G ((b) (c) (d)) + (x) + ac; \
(a) = ROTATE_LEFT ((a) (s)); \
(a) += (b); \
}
#define HH(a b c d x s ac) { \
(a) += H ((b) (c) (d)) + (x) + ac; \
(a) = ROTATE_LEFT ((a) (s)); \
(a) += (b); \
}
#define II(a b c d x s ac) { \
(a) += I ((b) (c) (d)) + (x) + ac; \
(a) = ROTATE_LEFT ((a) (s)); \
(a) += (b); \
}
const byte MD5::PADDING[64] = { 0x80 };
const char MD5::HEX[16] = {
‘0‘ ‘1‘ ‘2‘ ‘3‘
‘4‘ ‘5‘ ‘6‘ ‘7‘
‘8‘ ‘9‘ ‘a‘ ‘b‘
‘c‘ ‘d‘ ‘e‘ ‘f‘
};
/* Default construct. */
MD5::MD5() {
reset();
}
/* Construct a MD5 object with a input buffer. */
MD5::MD5(const void* input size_t length) {
reset();
update(input length);
}
/* Construct a MD5 object with a string. */
MD5::MD5(const string& str) {
reset();
update(str);
}
/* Construct a MD5 object with a file. */
MD5::MD5(ifstream& in) {
reset();
update(in);
}
/* Return the message-digest */
const byte* MD5::digest() {
if (!_finished) {
_finished = true;
final();
}
return _digest;
}
/* Reset the calculate state */
void MD5::reset() {
_finished = false;
/* reset number of bits. */
_count[0] = _count[1] = 0;
/* Load magic initialization constants. */
_state[0] = 0x67452301;
_state[1] = 0xefcdab89;
_state[2] = 0x98badcfe;
_state[3] = 0x10325476;
}
/* Updating the context with a input buffer. */
void MD5::update(const void* input size_t length) {
update((const byte*)input length);
}
/* Updating the context with a string. */
void MD5::update(const string& str) {
update((const byte*)str.c_str() str.length());
}
/* Updating the context with a file. */
void MD5::update(ifstream& in) {
if (!in) {
return;
}
std::streamsize length;
char buffer[BUFFER_SIZE];
while (!in.eof()) {
in.read(buffer BUFFER_SIZE);
length = in.gcount();
if (length > 0) {
update(buffer length);
}
}
in.close();
}
/* MD5 block update operation. Continues a
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-02-21 15:40 MD5Checker\
目录 0 2014-02-21 15:40 MD5Checker\MD5Checker\
文件 105436 2014-02-21 14:51 MD5Checker\MD5Checker\MD5Checker.aps
文件 1705 2014-02-21 13:26 MD5Checker\MD5Checker\MD5Checker.cpp
文件 469 2014-02-21 13:26 MD5Checker\MD5Checker\MD5Checker.h
文件 5485 2014-02-21 14:51 MD5Checker\MD5Checker\MD5Checker.rc
文件 5628 2014-02-21 14:50 MD5Checker\MD5Checker\MD5Checker.vcproj
文件 1423 2014-02-21 15:29 MD5Checker\MD5Checker\MD5Checker.vcproj.CORP.caizhiming.user
文件 5020 2014-02-21 14:50 MD5Checker\MD5Checker\MD5CheckerDlg.cpp
文件 698 2014-02-21 14:47 MD5Checker\MD5Checker\MD5CheckerDlg.h
文件 2923 2014-02-21 13:26 MD5Checker\MD5Checker\ReadMe.txt
文件 9512 2014-02-21 13:50 MD5Checker\MD5Checker\md5.cpp
文件 1298 2008-08-19 10:37 MD5Checker\MD5Checker\md5.h
目录 0 2014-02-21 15:40 MD5Checker\MD5Checker\res\
文件 67646 2014-02-21 15:27 MD5Checker\MD5Checker\res\MD5Checker.ico
文件 366 2014-02-21 13:26 MD5Checker\MD5Checker\res\MD5Checker.rc2
文件 16958 2014-02-21 15:20 MD5Checker\MD5Checker\res\MD5Checker64.ico
文件 774 2014-02-21 14:04 MD5Checker\MD5Checker\resource.h
文件 143 2014-02-21 13:26 MD5Checker\MD5Checker\stdafx.cpp
文件 1854 2014-02-21 13:26 MD5Checker\MD5Checker\stdafx.h
文件 1030 2014-02-21 13:26 MD5Checker\MD5Checker\targetver.h
文件 23694336 2014-02-21 15:40 MD5Checker\MD5Checker.ncb
文件 896 2014-02-21 13:26 MD5Checker\MD5Checker.sln
文件 13824 2014-02-21 15:29 MD5Checker\MD5Checker.suo
- 上一篇:VC++文件仿搜狗
- 下一篇:仿QQ迷你首页迷你资讯MFC,VC++源代码
相关资源
- C++中头文件与源文件的作用详解
- 基于mfc的多线程文件传输
- VC++ 多线程文件读写操作
- MFC数字钟(基于VC6.0)
- VC++MFC小游戏实例教程(实例)+MFC类库
- 文件传输和聊天程序(c语言实现)
- C语言中 文件读取和写入的详细操作代
- ChartCtrl控件库(可在VS2019中使用)
- 商品库存管理系统 C++ MFC
- 基于STM32F407ZG的监控摄像头及FATFS文件
- 51单片机protues文件(KST-51.DSN)
- PE文件操作代码
- 基于CS的TCP文件传输程序设计
- mfc 调用redis
- windows网络编程_文件传输
- MFC视频播放器源码(支持avi/wma/mp3等格
- mfc绘图大全(画直线、矩形、椭圆)
- MFC控件重绘
- hook,捕获所有案件,查找所有窗口,
- (学习)VS2010之MFC入门到精通教程
- 微型文件系统源码(FatFs)
- diy写字机grbl v1.1源代码
- MFC文档_视图_框架_模板结构体系深入
- 简单员工管理系统(适合初学MFC)
- Hex文件转bin文件
- stm32 实现Fatfs对U盘文件操作(main.c)
- c++ 文件操作(读取、写入)
- dll依赖文件检测工具
- MFC五子棋游戏
- MFC UDP编程
评论
共有 条评论