summaryrefslogtreecommitdiff
path: root/packages/hash/src
diff options
context:
space:
mode:
authorivost <ivost@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-01-20 10:27:12 +0000
committerivost <ivost@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-01-20 10:27:12 +0000
commit39be84fa26069829e4db68c2bc0ff90e889d6ef3 (patch)
tree8a577b0358d61e73258299844bfc2ee1bcca2e49 /packages/hash/src
parentd4f8452ef498b49e420e6936b220b7acea973f38 (diff)
downloadfpc-39be84fa26069829e4db68c2bc0ff90e889d6ef3.tar.gz
* fixed little bug in crc32 and crc64
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@12576 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/hash/src')
-rw-r--r--packages/hash/src/crc.pas10
1 files changed, 3 insertions, 7 deletions
diff --git a/packages/hash/src/crc.pas b/packages/hash/src/crc.pas
index 488762a811..1cd33a7acd 100644
--- a/packages/hash/src/crc.pas
+++ b/packages/hash/src/crc.pas
@@ -67,11 +67,6 @@ implementation
* CRC32
******************************************************************************)
-const
- CRC32_XINIT = $FFFFFFFF;
- CRC32_XOROT = $FFFFFFFF;
-
-
{$IFDEF DYNAMIC_CRC_TABLE}
{local}
@@ -218,13 +213,14 @@ end;
function crc32 (crc : cardinal; buf : Pbyte; len : cardinal): cardinal;
begin
if buf = nil then
- exit(0{CRC32_XINIT});
+ exit(0);
{$IFDEF DYNAMIC_CRC_TABLE}
if crc32_table_empty then
make_crc32_table;
{$ENDIF}
+ crc := crc xor $FFFFFFFF;
while (len >= 8) do
begin
crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
@@ -253,7 +249,7 @@ begin
dec(len);
until (len = 0);
- result := crc; //xor CRC32_XOROT;
+ result := crc xor $FFFFFFFF;
end;