* tried to make it 64 bit safe

git-svn-id: trunk@4701 -
This commit is contained in:
florian 2006-09-24 07:28:01 +00:00
parent 0266766abc
commit aec8c2a466

View File

@ -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; Index: PtrUInt;
PartLen: cardinal; PartLen: PtrUInt;
I: cardinal; 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; I : PtrUInt;
Pad : cardinal; 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;