indy9 indy10 MD5 实现方法

uses IdHashMessageDigest,IdHash;

function CheckFileByMD5(const AFile: TFileName): string;
var
  MyMD5: TIdHashMessageDigest5;
  Digest: T4x4LongWordRecord;
  ZipStream: TMemoryStream;
begin
  ZipStream := TMemoryStream.Create;
  ZipStream.LoadFromFile(AFile);
  MyMD5 := TIdHashMessageDigest5.Create;
  // Digest := MyMD5.HashValue(ZipStream);  {indy9}
  Result := MyMD5.HashStreamAsHex(ZipStream);  {indy10}
  ZipStream.Free;
  // Result := MyMD5.AsHex(Digest);  {indy9}
  MyMD5.Free;
end;

你可能感兴趣的:(MD5,indy9,indy10,实现方法)