--- a/hedgewars/CMakeLists.txt Fri Jan 26 18:11:03 2007 +0000
+++ b/hedgewars/CMakeLists.txt Fri Jan 26 18:39:40 2007 +0000
@@ -28,6 +28,7 @@
uLocale.pas
uMisc.pas
uRandom.pas
+ uSHA.pas
uSound.pas
uStore.pas
uTeams.pas
--- a/hedgewars/uLand.pas Fri Jan 26 18:11:03 2007 +0000
+++ b/hedgewars/uLand.pas Fri Jan 26 18:39:40 2007 +0000
@@ -59,6 +59,9 @@
procedure CheckLandDigest(s: shortstring);
const digest: shortstring = '';
begin
+{$IFDEF DEBUGFILE}
+AddFileLog('CheckLandDigest: ' + s);
+{$ENDIF}
if digest = '' then
digest:= s
else
--- a/hedgewars/uSHA.pas Fri Jan 26 18:11:03 2007 +0000
+++ b/hedgewars/uSHA.pas Fri Jan 26 18:39:40 2007 +0000
@@ -25,7 +25,7 @@
Length, CurrLength: Int64;
Buf: array[0..63] of byte;
end;
- TSHA1Digest = array[0.. 4] of LongWord;
+ TSHA1Digest = array[0..4] of LongWord;
procedure SHA1Init(var Context: TSHA1Context);
procedure SHA1Update(var Context: TSHA1Context; Buf: PByteArray; Length: LongWord);
@@ -101,11 +101,11 @@
end;
procedure SHA1Update(var Context: TSHA1Context; Buf: PByteArray; Length: LongWord);
-var i: integer;
+var i: Longword;
begin
for i:= 0 to Pred(Length) do
begin
- Context.Buf[Context.CurrLength]:= PByteArray(Buf)^[i];
+ Context.Buf[Context.CurrLength]:= Buf^[i];
inc(Context.CurrLength);
if Context.CurrLength = 64 then
begin
@@ -118,7 +118,6 @@
function SHA1Final(Context: TSHA1Context): TSHA1Digest;
var i: LongWord;
- Result: TSHA1Digest;
begin
Context.Length:= Context.Length + Context.CurrLength shl 3;
Context.Buf[Context.CurrLength]:= $80;
@@ -137,9 +136,8 @@
for i:= 56 to 63 do
Context.Buf[i] := (Context.Length shr ((63 - i) * 8)) and $FF;
SHA1Hash(Context);
-move(Context.H, Result, sizeof(TSHA1Digest));
-FillChar(Context, sizeof(Context), 0);
-SHA1Final:= Result
+for i:= 0 to 4 do SHA1Final[i]:= Context.H[i];
+FillChar(Context, sizeof(Context), 0)
end;
end.