首页 > 代码库 > 获取文件sha1 值

获取文件sha1 值

 

单元 IdHashSHA申明

function GetFile_SHA1(const iFileName: String): String; //Checksum hash value for firefox

var
SHA1 : TIdHashSHA1;
fileStream: TMemoryStream;
begin
SHA1 := TIdHashSHA1.Create;
fileStream := TMemoryStream.Create;
try
fileStream.LoadFromFile(iFileName);
Result := SHA1.HashStreamAsHex(fileStream);
finally
fileStream.Free;
SHA1.Free;
end;
end;