local path_src = File.GetAbsolute("./src/") local path_out = File.GetAbsolute("./out/") -- 创建输出目录 File.DeleteContent(path_out) File.CreateFolder(path_out) local ret_files = File.GetPathFileAll(path_src) local vec_crc32 = {} local vec_md5 = {} local vec_sha256 = {} for key, value in pairs(ret_files) do local buf = File.GetBuffer(value) local crc32 = Crypto.HashCrc32(buf, 0) local md5 = Crypto.HashMd5(buf) local sha256 = Crypto.HashSha256(buf) value = File.GetRelative(value, path_src) vec_crc32[value] = crc32 vec_md5[value] = md5 vec_sha256[value] = sha256 end local func_save = function(vec, name) local str = "" for key, value in pairs(vec) do str = str .. to_string(value) .. "\t" .. key .. "\n" end File.SaveString(str, path_out .. name) end func_save(vec_crc32, "crc32.txt") func_save(vec_md5, "md5.txt") func_save(vec_sha256, "sha256.txt") print "此工具将src文件夹内的文件,计算出crc32、md5、sha256,保存到out文件夹内" pause()