import win.ui;
/*DSG{{*/
var winform = ..win.form( text="AAuto Hasher - 计算文件的MD5,SHA1,CRC32校验值 作者:lujjjh";acceptfiles=1;bottom=300;parent=...;right=479 )
winform.add(
progress={ dr=1;dl=1;bottom=284;max=100;right=472;left=8;min=0;font=LOGFONT( name='宋体' );z=1;db=1;top=264;edge=1;cls="progress" };
static={ bottom=21;text="请从外部拖动文件到下面的文本框中:";left=13;dt=1;top=5;transparent=1;right=336;z=3;cls="static" };
richedit={ dr=1;dl=1;vscroll=1;right=472;left=8;dt=1;db=1;cls="richedit";bottom=256;wrap=1;multiline=1;top=25;font=LOGFONT( name='宋体' );z=2;edge=1;readonly=1 }
)
/*}}*/
import crypt
getHash = function (szPath) {
winform.modifyStyleEx( 0x10/*_WS_EX_ACCEPTFILES*/);
winform.richedit.appendText( "正在计算..." , szPath , '\n');
//定义哈希变量
var crc32;
var md5 = crypt().createHashByMd5();
var sha1 = crypt().createHashBySha1()
//打开文件
var file,err = io.open(szPath, "rbR");//R 随机优化
if(!file) error("打开文件失败" + err,2 )
//计算哈希值
bufsize = 1024 * 1024;
var buffer = raw.malloc( bufsize );
winform.progress.step = 1;
winform.progress.max = file.size(bufsize);
winform.progress.pos = 0;
var readSize = file.readBuffer(buffer);
while ( readSize ){
md5.hashBuffer(buffer,readSize);
sha1.hashBuffer(buffer,readSize);
crc32 = string.crc32(buffer,crc32,readSize)
win.peekPumpMessage()
winform.progress.stepIt()
readSize = file.readBuffer(buffer)
};
file.close();
//显示结果
winform.richedit.appendText(
'MD5:\t' , md5.getHexValue() , '\n',
'SHA1:\t', sha1.getHexValue(), '\n',
'CRC32:\t', ..string.format("%X",crc32 ), '\n',
string.repeat(40, "-") , '\n'
);
winform.modifyStyleEx( ,0x10/*_WS_EX_ACCEPTFILES*/);
}
winform.wndproc = function(hwnd,message,wParam,lParam){
select(message) {//判断消息类型
case 0x233/*_WM_DROPFILES*/ {
var szPath = win.getDropFile(wParam);
for (k,v in szPath) {
getHash(v);
}
}
}
}
winform.progress.bottom = winform.progress.bottom - 8;
winform.show();
win.loopMessage();
------解决方案--------------------撸主,您就是百度贴吧之vb吧的 ydm_bd 大侠?
------解决方案--------------------呵呵,厉害厉害

不过看不懂啊
------解决方案--------------------一直都用搜的小工具来算,没想到还有这个坑儿~~~
------解决方案--------------------直接用C#的MD5类就OK了。网上很多C/C++的代码生成的结果和C#的不一样。
static void Main(string[] args)
{
string str = "http://blog.csdn.net/MoreWindows";
Console.WriteLine(md5(str));