⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wmd5.cpp

📁 Windows下方便簡單的免費MD5驗證工具WMD5
💻 CPP
字号:
// wmd5.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <direct.h>

#include "stdafx.h"
#include "wmd5.h"
#include "md5.h"

extern "C"
{
    #include "getopt.h"         // GetOption
}

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;
char pname[_MAX_PATH];
char curdir[_MAX_PATH];
char files[_MAX_PATH];
FILE *md5fp;
char logfname[_MAX_PATH]="";
bool bOutFile = FALSE,
	bStandOut = FALSE,
	bRecursive = FALSE,
	bVerbose = FALSE,
	bHidden = FALSE;


using namespace std;

unsigned char *md5string(unsigned char res[33])
{
static const char hex[] = "0123456789abcdef";

	unsigned char Digest[33]="";
    for(int i=0;i<16;i++) {
       Digest[i+i] = hex[res[i]>>4];
	   Digest[i+i+1] = hex[res[i]&0x0f];
	}
    Digest[i+i] = '\0';
	strcpy((char *)res,(char *)Digest);
	return res;
}

void printmd5(char *fname,char *lcurdir)
{
	WIN32_FIND_DATA MyFoundFile;
	HANDLE Hfound;
	char dlist[_MAX_PATH];

	strcpy(dlist,lcurdir);
	strcat(dlist,"/");
	strcat(dlist,fname);

	// cout << "dlist = " << dlist << endl;
	
	SetCurrentDirectory(lcurdir);

	if (bOutFile)
		md5fp = fopen(logfname,"w");
	else
		md5fp = fopen("checksum.md5","w");

	Hfound = FindFirstFile(dlist,&MyFoundFile);
	if(Hfound != INVALID_HANDLE_VALUE)
	{
		do {
			try
			{
				char fname[_MAX_PATH];
				strcpy(fname,lcurdir);
				strcat(fname,"/");
				strcat(fname,MyFoundFile.cFileName);

				if( strstr(MyFoundFile.cFileName,".md5") )
					continue;

				if ( !strncmp(logfname,MyFoundFile.cFileName,strlen(MyFoundFile.cFileName) ) )
					continue;

				// CHECK 琌

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -