델파이 기본 Hash를 이용한 MD5 파일 Check입니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Uses idHash, IdHashMessageDigest; function MD5(const fileName : string) : string; var idmd5 : TIdHashMessageDigest5; fs : TFileStream; hash : T4x4LongWordRecord; begin idmd5 := TIdHashMessageDigest5.Create; fs := TFileStream.Create(fileName, fmOpenRead OR fmShareDenyWrite) ; try result := idmd5.HashStreamAsHex( fs ) ; finally fs.Free; idmd5.Free; end; end; var s : String; c : integer; begin if OpenDialog1.Execute( handle ) then begin c := GetTickCount; S := Md5( OpenDialog1.FileName ); c := GetTickCount - c; Memo1.Lines.Add( intToStr( C ) + ' : ' + S ); end; |
최신 댓글