File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ interface
1111
1212uses
1313 Classes, SysUtils,
14- simba.base, simba.fs ;
14+ simba.base;
1515
1616type
1717 { $SCOPEDENUMS ON}
@@ -63,13 +63,28 @@ function HashString(Algo: EHashAlgo; const S: String): String;
6363
6464function HashFile (Algo: EHashAlgo; const FileName: String): String;
6565var
66+ Stream: TFileStream;
6667 Bytes: TByteArray;
6768begin
69+ Bytes := [];
70+ Stream := nil ;
71+
6872 try
69- Bytes := TSimbaFile.FileReadBytes((FileName);
73+ Stream := TFileStream.Create(FileName, fmOpenRead);
74+ if (Len = -1 ) then
75+ Len := $FFFFFF;
76+ SetLength(Bytes, Min(Len, Stream.Size - Offset));
77+ if (Length(Bytes) > 0 ) then
78+ begin
79+ Stream.Seek(Offset, soBeginning);
80+ Stream.ReadBuffer(Bytes[0 ], Length(Bytes));
81+ end ;
7082 except
7183 end ;
7284
85+ if (Stream <> nil ) then
86+ Stream.Free();
87+
7388 if (Length(Bytes) > 0 ) then
7489 Result := HashBuffer(Algo, @Bytes[0 ], Length(Bytes))
7590 else
You can’t perform that action at this time.
0 commit comments