summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/hash/src/sha1.pp11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/hash/src/sha1.pp b/packages/hash/src/sha1.pp
index ed8917cfd3..e5998a5d69 100644
--- a/packages/hash/src/sha1.pp
+++ b/packages/hash/src/sha1.pp
@@ -51,6 +51,8 @@ function SHA1Match(const Digest1, Digest2: TSHA1Digest): Boolean;
implementation
+uses sysutils,sysconst;
+
// inverts the bytes of (Count div 4) cardinals from source to target.
procedure Invert(Source, Dest: Pointer; Count: PtrUInt);
var
@@ -257,6 +259,11 @@ begin
SHA1Final(Context, Result);
end;
+procedure RaiseFileNotFoundException(const fn : String);
+begin
+ raise EFileNotFoundException.Create(SFileNotFound);
+end;
+
function SHA1File(const Filename: String; const Bufsize: PtrUInt): TSHA1Digest;
var
F: File;
@@ -284,7 +291,9 @@ begin
until Count < BufSize;
FreeMem(Buf, BufSize);
Close(F);
- end;
+ end
+ else
+ RaiseFileNotFoundException(FileName);
SHA1Final(Context, Result);
FileMode := ofm;