比较两个文件哈希值是否完全相等

fn CompareFile p_1 p_2 =  	--/// 比较两个文件哈希值是否完全相等
(
	hash = (dotnetclass "System.Security.Cryptography.HashAlgorithm").Create() 	--//计算第一个文件的哈希值
	stream_1 = dotnetobject "System.IO.FileStream" p_1 (dotnetclass "System.IO.FileMode").Open
	hashByte_1 = hash.ComputeHash stream_1
	stream_1.Close()
	stream_2 = dotnetobject "System.IO.FileStream" p_2 (dotnetclass "System.IO.FileMode").Open 	--//计算第二个文件的哈希值
	hashByte_2 = hash.ComputeHash(stream_2)
	stream_2.Close()
	if (dotnetclass "System.BitConverter").ToString(hashByte_1) == (dotnetclass "System.BitConverter").ToString(hashByte_2) then (true)else(false)--//比较两个哈希值
)

评论0

请先

没有账号? 注册  忘记密码?

社交账号快速登录