Browse Source

* tried to make it 64 bit safe

git-svn-id: trunk@4701 -
florian 19 years ago
parent
commit
aec8c2a466
1 changed files with 15 additions and 15 deletions
  1. 15 15
      packages/base/hash/md5.pp

+ 15 - 15
packages/base/hash/md5.pp

@@ -26,7 +26,7 @@ Interface
 
 
 type
 type
   PCardinal = ^Cardinal;
   PCardinal = ^Cardinal;
-  TMD5Count = array[0..1] of Cardinal;
+  TMD5Count = array[0..1] of PtrUInt;
   TMD5State = array[0..3] of Cardinal;
   TMD5State = array[0..3] of Cardinal;
   TMD5Block = array[0..15] of Cardinal;
   TMD5Block = array[0..15] of Cardinal;
   TMD5CBits = array[0..7] of byte;
   TMD5CBits = array[0..7] of byte;
@@ -44,15 +44,15 @@ Const
 { Raw methods }
 { Raw methods }
 
 
 procedure MD5Init(var Context: TMD5Context);
 procedure MD5Init(var Context: TMD5Context);
-procedure MD5Update(var Context: TMD5Context; Var Buf; BufLen: cardinal);
+procedure MD5Update(var Context: TMD5Context; Var Buf; BufLen: PtrUInt);
 procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest);
 procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest);
 
 
 { Auxiliary methods }
 { Auxiliary methods }
 
 
 function MD5String(M: string): TMD5Digest;
 function MD5String(M: string): TMD5Digest;
-function MD5Buffer(Var Buf; BufLen: cardinal): TMD5Digest;
+function MD5Buffer(Var Buf; BufLen: PtrUInt): TMD5Digest;
 function MD5File(N: string): TMD5Digest;
 function MD5File(N: string): TMD5Digest;
-function MD5File(N: string; Bufsize : Cardinal): TMD5Digest;
+function MD5File(N: string; Bufsize : PtrUInt): TMD5Digest;
 function MD5Print(D: TMD5Digest): String;
 function MD5Print(D: TMD5Digest): String;
 // based on an implementation by Matthias Fichtner
 // based on an implementation by Matthias Fichtner
 function MD5Match(D1, D2: TMD5Digest): boolean;
 function MD5Match(D1, D2: TMD5Digest): boolean;
@@ -135,12 +135,12 @@ end;
 
 
 // inverts the bytes of (Count div) 4 cardinals from source to target.
 // inverts the bytes of (Count div) 4 cardinals from source to target.
 
 
-procedure Invert(Source,Target: pointer; Count: cardinal);
+procedure Invert(Source,Target: pointer; Count: PtrUInt);
 
 
 var
 var
   S: PByte;
   S: PByte;
   T: PCardinal;
   T: PCardinal;
-  I: cardinal;
+  I: PtrUInt;
 
 
 begin
 begin
   S := Source;
   S := Source;
@@ -254,12 +254,12 @@ end;
 
 
 
 
 
 
-procedure MD5Update(var Context: TMD5Context; Var Buf; BufLen: cardinal);
+procedure MD5Update(var Context: TMD5Context; Var Buf; BufLen: PtrUInt);
 
 
 var
 var
-  Index: cardinal;
-  PartLen: cardinal;
-  I: cardinal;
+  Index: PtrUInt;
+  PartLen: PtrUInt;
+  I: PtrUInt;
   P : PByte;
   P : PByte;
 
 
 begin
 begin
@@ -294,8 +294,8 @@ procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest);
 
 
 var
 var
   Bits: TMD5CBits;
   Bits: TMD5CBits;
-  I : cardinal;
-  Pad : cardinal;
+  I : PtrUInt;
+  Pad : PtrUInt;
 
 
 begin
 begin
   Invert(@Context.Count, @Bits, 8);
   Invert(@Context.Count, @Bits, 8);
@@ -322,7 +322,7 @@ begin
   MD5Final(Context, Result);
   MD5Final(Context, Result);
 end;
 end;
 
 
-function MD5Buffer(var Buf; BufLen: cardinal): TMD5Digest;
+function MD5Buffer(var Buf; BufLen: PtrUInt): TMD5Digest;
 var
 var
   Context: TMD5Context;
   Context: TMD5Context;
 
 
@@ -339,7 +339,7 @@ begin
 end;
 end;
 
 
 
 
-function MD5File(N: string; BufSize : Cardinal): TMD5Digest;
+function MD5File(N: string; BufSize : PtrUInt): TMD5Digest;
 
 
 var
 var
   F : File;
   F : File;
@@ -347,7 +347,7 @@ var
   Context: TMD5Context;
   Context: TMD5Context;
   Count : Longint;
   Count : Longint;
   ofm : Longint;
   ofm : Longint;
-  
+
 begin
 begin
   MD5Init(Context);
   MD5Init(Context);
   Assign(F,N);
   Assign(F,N);