这是我编写的MD5加密算法的全部源代码MD5加密算法.dsp This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally. M
在网上查了一下,在网上收集了Java与Javascr ipt中使用的两个例子,试验过,分享下。
1、Java:
package org.bearfly.test.md5;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Utils {
public st
C#端
using System;
using System.IO;
using System.Security.Cryptography;
namespace 计算文件的MD5值
{
class MD5_Helper
{
///
/// 文件MD5校验
///
/// 文件绝对路径
/// MD5校验码
public string getMD5Hash(string pathName)
测试结果和百度百科测试例子一致。
实现过程中需要注意事项:最后把四个变量A B C D 链接成结果时 ,注意变量高低位的先后顺序,具体参考 LinkResult()方法。
md5.h
#ifndef _MD5_H_
#define _MD5_H_
#include
#include
using namespace std;
class MD5
{
public:
typedef unsigned char uchar8; //make sure it is 8bit