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

📄 md5.cpp

📁 MD5算法C语言实现.rar非常好的一个算法
💻 CPP
字号:
// MD5.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "md5.h"
#include "stdlib.h"
#include "string.h"



int main(int argc, char* argv[])
{
	char t[80], path[80];
	
	printf( "****************************A Md5 generator**************************\n");
	printf( "Usage: Type the full path of a file or drag the file icon            \n");
	printf( "       into the window by mouse, then press enter.                   \n");
	printf( "Input path of the file:");
	gets( t);

	for( int i = 0, j = 0; i < strlen(t); i ++)
	{
		if( t[i] != 34)
		{
			path[j] = t[i];
			if( t[i] == 92)
			{
				path[j+1] = path[j];
				j ++;
			}
			j ++;
		}
	}

	path[j] = '\0';
	
	FILE *fp = fopen( path, "rb");
	if(fp == NULL)
	{
		printf("Can't open the file!\n");
		system( "pause");
		return 1;
	}

	unsigned char md5[16];

	unsigned f_size = Md5( fp, md5);

	cout << "FileSize:" << f_size << " Bytes" << endl;

	printf( "Md5:");

	for( i = 0; i < 16; i ++)
	{
		printf( "%x", (md5[i] >> 4) & 0xf);
		printf( "%x", md5[i] & 0xf);
	}
	
	cout << endl;

	system( "pause");
	return 0;
}

⌨️ 快捷键说明

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