Browse Source

* added crc64 function
* added crc examples (not finished)
* improved md5

git-svn-id: trunk@12573 -

ivost 16 years ago
parent
commit
4ab7922296

+ 1 - 0
.gitattributes

@@ -2534,6 +2534,7 @@ packages/hash/Makefile svneol=native#text/plain
 packages/hash/Makefile.fpc svneol=native#text/plain
 packages/hash/Makefile.fpc svneol=native#text/plain
 packages/hash/examples/Makefile svneol=native#text/plain
 packages/hash/examples/Makefile svneol=native#text/plain
 packages/hash/examples/Makefile.fpc svneol=native#text/plain
 packages/hash/examples/Makefile.fpc svneol=native#text/plain
+packages/hash/examples/crctest.pas svneol=native#text/plain
 packages/hash/examples/md5.ref svneol=native#text/plain
 packages/hash/examples/md5.ref svneol=native#text/plain
 packages/hash/examples/mdtest.pas svneol=native#text/plain
 packages/hash/examples/mdtest.pas svneol=native#text/plain
 packages/hash/fpmake.pp svneol=native#text/plain
 packages/hash/fpmake.pp svneol=native#text/plain

+ 59 - 59
packages/hash/examples/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/12/12]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/01/19]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -263,178 +263,178 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_PROGRAMS+=mdtest
+override TARGET_PROGRAMS+=mdtest crctest
 endif
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 ifdef REQUIRE_UNITSDIR
 ifdef REQUIRE_UNITSDIR

+ 1 - 1
packages/hash/examples/Makefile.fpc

@@ -3,7 +3,7 @@
 #
 #
 
 
 [target]
 [target]
-programs=mdtest
+programs=mdtest crctest
 
 
 [require]
 [require]
 packages=hash
 packages=hash

+ 54 - 0
packages/hash/examples/crctest.pas

@@ -0,0 +1,54 @@
+program crctest;
+
+{$mode objfpc}
+{$h+}
+
+uses
+  sysutils,
+  crc;
+
+const
+  testseq1: string = 'MNIIQGNLVGTGLKIGIVVGRFNDFITSKLLSGAEDALLRHGVDTNDIDVAWVPGAFEIPFAAKKMAETKKYDAIITLGTVIRGATTSYDYVCNEAAKGIAQAANTTGVPVIFGIVTTENIEQAIERAGTKAGNKGVDCAVSAIEMANLNRSFE';
+  testseq2: string = 'MNIIQGNLVGTGLKIGIVVGRFNDFITSKLLSGAEDALLRHGVDTNDIDVAWVPGAFEIPFAAKKMAETKKYDAIITLGDVIRGATTHYDYVCNEAAKGIAQAANTTGVPVIFGIVTTENIEQAIERAGTKAGNKGVDCAVSAIEMANLNRSFE';
+
+  test1_crc64: qword = 1;
+  test2_crc64: qword = 1;
+  test1_crc32: longword = 1;
+  test2_crc32: longword = 1;
+
+
+procedure perform_crc32(const name, testcase: string; result: longword);
+var
+  crc: longword;
+begin
+  crc := crc32(0,nil,0);
+  crc := crc32(crc,@testcase[1],length(testcase));
+
+  write(name,': ');
+  if crc=result then
+    writeln('passed')
+  else
+    writeln('failed');
+end;
+
+procedure perform_crc64(const name, testcase: string; result: qword);
+var
+  crc: qword;
+begin
+  crc := crc64(0,nil,0);
+  crc := crc64(crc,@testcase[1],length(testcase));
+
+  write(name,': ');
+  if crc=result then
+    writeln('passed')
+  else
+    writeln('failed');
+end;
+
+
+begin
+  perform_crc32('crc32', testseq1, test1_crc32);
+  perform_crc32('crc32', testseq2, test2_crc32);
+  perform_crc64('crc64', testseq1, test1_crc64);
+  perform_crc64('crc64', testseq2, test2_crc64);
+end.

+ 241 - 50
packages/hash/src/crc.pas

@@ -1,5 +1,7 @@
 unit crc;
 unit crc;
 
 
+{$mode objfpc}
+
 {
 {
   crc32.c -- compute the CRC-32 of a data stream
   crc32.c -- compute the CRC-32 of a data stream
   Copyright (C) 1995-1998 Mark Adler
   Copyright (C) 1995-1998 Mark Adler
@@ -7,11 +9,25 @@ unit crc;
   Pascal tranlastion
   Pascal tranlastion
   Copyright (C) 1998 by Jacques Nomssi Nzali
   Copyright (C) 1998 by Jacques Nomssi Nzali
   For conditions of distribution and use, see copyright notice in readme.txt
   For conditions of distribution and use, see copyright notice in readme.txt
+
+
+  crc64.c -- compute the CRC-64 of a data stream
+  By David T. Jones ([email protected])  - September 28th 2002
+
+  Pascal tranlastion
+  Copyright (C) 2009 by Ivo Steinmann
 }
 }
 
 
+{.$DEFINE DYNAMIC_CRC_TABLE}
+
 interface
 interface
 
 
-function crc32(crc : cardinal; buf : Pbyte; len : cardinal) : cardinal;
+
+(******************************************************************************
+ * CRC32
+ ******************************************************************************)
+
+function crc32(crc: cardinal; buf: Pbyte; len: cardinal): cardinal;
 
 
 {  Update a running crc with the bytes buf[0..len-1] and return the updated
 {  Update a running crc with the bytes buf[0..len-1] and return the updated
    crc. If buf is NULL, this function returns the required initial value
    crc. If buf is NULL, this function returns the required initial value
@@ -32,19 +48,33 @@ function crc32(crc : cardinal; buf : Pbyte; len : cardinal) : cardinal;
 
 
 }
 }
 
 
-function get_crc_table : Pcardinal;  { can be used by asm versions of crc32() }
+function get_crc32_table: Pcardinal;  { can be used by asm versions of crc32() }
+
 
 
 
 
+(******************************************************************************
+ * CRC64
+ ******************************************************************************)
+
+function crc64(crc: qword; buf: Pbyte; len: cardinal) : qword;
+
+function get_crc64_table: PQword;  { can be used by asm versions of crc64() }
+
 implementation
 implementation
 
 
+
+(******************************************************************************
+ * CRC32
+ ******************************************************************************)
+
 {$IFDEF DYNAMIC_CRC_TABLE}
 {$IFDEF DYNAMIC_CRC_TABLE}
 
 
 {local}
 {local}
 const
 const
-  crc_table_empty : boolean = TRUE;
+  crc32_table_empty : boolean = TRUE;
 {local}
 {local}
 var
 var
-  crc_table : array[0..256-1] of uLongf;
+  crc32_table : array[Byte] of Longword;
 
 
 
 
 {
 {
@@ -72,7 +102,7 @@ var
   combinations of CRC register values and incoming bytes.
   combinations of CRC register values and incoming bytes.
 }
 }
 {local}
 {local}
-procedure make_crc_table;
+procedure make_crc32_table;
 var
 var
  c    : cardinal;
  c    : cardinal;
  n,k  : integer;
  n,k  : integer;
@@ -98,19 +128,19 @@ begin
       else
       else
         c := (c shr 1);
         c := (c shr 1);
     end;
     end;
-    crc_table[n] := c;
+    crc32_table[n] := c;
   end;
   end;
-  crc_table_empty := FALSE;
+  crc32_table_empty := FALSE;
 end;
 end;
 
 
 {$ELSE}
 {$ELSE}
 
 
 { ========================================================================
 { ========================================================================
-  Table of CRC-32's of all single-byte values (made by make_crc_table) }
+  Table of CRC-32's of all single-byte values (made by make_crc32_table) }
 
 
 {local}
 {local}
 const
 const
-  crc_table : array[0..256-1] of cardinal = (
+  crc32_table : array[Byte] of cardinal = (
   $00000000, $77073096, $ee0e612c, $990951ba, $076dc419,
   $00000000, $77073096, $ee0e612c, $990951ba, $076dc419,
   $706af48f, $e963a535, $9e6495a3, $0edb8832, $79dcb8a4,
   $706af48f, $e963a535, $9e6495a3, $0edb8832, $79dcb8a4,
   $e0d5e91e, $97d2d988, $09b64c2b, $7eb17cbd, $e7b82d07,
   $e0d5e91e, $97d2d988, $09b64c2b, $7eb17cbd, $e7b82d07,
@@ -169,63 +199,224 @@ const
 { =========================================================================
 { =========================================================================
   This function can be used by asm versions of crc32() }
   This function can be used by asm versions of crc32() }
 
 
-function get_crc_table : {const} Pcardinal;
+function get_crc32_table : {const} Pcardinal;
 begin
 begin
 {$ifdef DYNAMIC_CRC_TABLE}
 {$ifdef DYNAMIC_CRC_TABLE}
-  if (crc_table_empty) then
-    make_crc_table;
+  if (crc32_table_empty) then
+    make_crc32_table;
 {$endif}
 {$endif}
-  get_crc_table :=  {const} Pcardinal(@crc_table);
+  get_crc32_table :=  {const} Pcardinal(@crc32_table);
 end;
 end;
 
 
 { ========================================================================= }
 { ========================================================================= }
 
 
 function crc32 (crc : cardinal; buf : Pbyte; len : cardinal): cardinal;
 function crc32 (crc : cardinal; buf : Pbyte; len : cardinal): cardinal;
 begin
 begin
-  if (buf = nil) then
-    crc32 := 0
-  else
-  begin
+  if buf = nil then
+    exit(0);
 
 
 {$IFDEF DYNAMIC_CRC_TABLE}
 {$IFDEF DYNAMIC_CRC_TABLE}
-    if crc_table_empty then
-      make_crc_table;
+  if crc32_table_empty then
+    make_crc32_table;
 {$ENDIF}
 {$ENDIF}
 
 
-    crc := crc xor cardinal($ffffffff);
-    while (len >= 8) do
+  crc := crc xor cardinal($ffffffff);
+  while (len >= 8) do
+  begin
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    dec(len, 8);
+  end;
+
+  if (len <> 0) then
+  repeat
+    crc := crc32_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    dec(len);
+  until (len = 0);
+
+  result := crc xor cardinal($ffffffff);
+end;
+
+
+
+(******************************************************************************
+ * CRC64
+ ******************************************************************************)
+
+const
+  POLY64REV  = QWord($95AC9329AC4BC9B5);
+  INITIALCRC = QWord($FFFFFFFFFFFFFFFF);
+
+{$IFDEF DYNAMIC_CRC_TABLE}
+
+{local}
+const
+  crc64_table_empty : boolean = TRUE;
+{local}
+var
+  crc64_table : array[Byte] of QWord;
+
+{local}
+procedure make_crc64_table;
+var
+  i,j: Integer;
+  part: QWord;
+begin
+  for i := 0 to 255 do
+  begin
+    part := i;
+    for j := 0 to 7 do
     begin
     begin
-      {DO8(buf)}
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-
-      dec(len, 8);
+      if part and $1 <> 0 then
+        part := (part shr 1) xor POLY64REV
+      else
+        part := part shr 1;
     end;
     end;
-    if (len <> 0) then
-    repeat
-      {DO1(buf)}
-      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
-      inc(buf);
-
-      dec(len);
-    until (len = 0);
-    crc32 := crc xor cardinal($ffffffff);
+    crc64_table[i] := part;
   end;
   end;
+  crc64_table_empty := FALSE;
+end;
+
+{$ELSE}
+
+{ ========================================================================
+  Table of CRC-64's of all single-byte values (made by make_crc64_table) }
+
+{local}
+const
+  crc64_table : array[Byte] of QWord = (
+    $0000000000000000,$7AD870C830358979,$F5B0E190606B12F2,$8F689158505E9B8B,$C038E5739841B68F,$BAE095BBA8743FF6,
+    $358804E3F82AA47D,$4F50742BC81F2D04,$AB28ECB46814FE75,$D1F09C7C5821770C,$5E980D24087FEC87,$24407DEC384A65FE,
+    $6B1009C7F05548FA,$11C8790FC060C183,$9EA0E857903E5A08,$E478989FA00BD371,$7D08FF3B88BE6F81,$07D08FF3B88BE6F8,
+    $88B81EABE8D57D73,$F2606E63D8E0F40A,$BD301A4810FFD90E,$C7E86A8020CA5077,$4880FBD87094CBFC,$32588B1040A14285,
+    $D620138FE0AA91F4,$ACF86347D09F188D,$2390F21F80C18306,$594882D7B0F40A7F,$1618F6FC78EB277B,$6CC0863448DEAE02,
+    $E3A8176C18803589,$997067A428B5BCF0,$FA11FE77117CDF02,$80C98EBF2149567B,$0FA11FE77117CDF0,$75796F2F41224489,
+    $3A291B04893D698D,$40F16BCCB908E0F4,$CF99FA94E9567B7F,$B5418A5CD963F206,$513912C379682177,$2BE1620B495DA80E,
+    $A489F35319033385,$DE51839B2936BAFC,$9101F7B0E12997F8,$EBD98778D11C1E81,$64B116208142850A,$1E6966E8B1770C73,
+    $8719014C99C2B083,$FDC17184A9F739FA,$72A9E0DCF9A9A271,$08719014C99C2B08,$4721E43F0183060C,$3DF994F731B68F75,
+    $B29105AF61E814FE,$C849756751DD9D87,$2C31EDF8F1D64EF6,$56E99D30C1E3C78F,$D9810C6891BD5C04,$A3597CA0A188D57D,
+    $EC09088B6997F879,$96D1784359A27100,$19B9E91B09FCEA8B,$636199D339C963F2,$DF7ADABD7A6E2D6F,$A5A2AA754A5BA416,
+    $2ACA3B2D1A053F9D,$50124BE52A30B6E4,$1F423FCEE22F9BE0,$659A4F06D21A1299,$EAF2DE5E82448912,$902AAE96B271006B,
+    $74523609127AD31A,$0E8A46C1224F5A63,$81E2D7997211C1E8,$FB3AA75142244891,$B46AD37A8A3B6595,$CEB2A3B2BA0EECEC,
+    $41DA32EAEA507767,$3B024222DA65FE1E,$A2722586F2D042EE,$D8AA554EC2E5CB97,$57C2C41692BB501C,$2D1AB4DEA28ED965,
+    $624AC0F56A91F461,$1892B03D5AA47D18,$97FA21650AFAE693,$ED2251AD3ACF6FEA,$095AC9329AC4BC9B,$7382B9FAAAF135E2,
+    $FCEA28A2FAAFAE69,$8632586ACA9A2710,$C9622C4102850A14,$B3BA5C8932B0836D,$3CD2CDD162EE18E6,$460ABD1952DB919F,
+    $256B24CA6B12F26D,$5FB354025B277B14,$D0DBC55A0B79E09F,$AA03B5923B4C69E6,$E553C1B9F35344E2,$9F8BB171C366CD9B,
+    $10E3202993385610,$6A3B50E1A30DDF69,$8E43C87E03060C18,$F49BB8B633338561,$7BF329EE636D1EEA,$012B592653589793,
+    $4E7B2D0D9B47BA97,$34A35DC5AB7233EE,$BBCBCC9DFB2CA865,$C113BC55CB19211C,$5863DBF1E3AC9DEC,$22BBAB39D3991495,
+    $ADD33A6183C78F1E,$D70B4AA9B3F20667,$985B3E827BED2B63,$E2834E4A4BD8A21A,$6DEBDF121B863991,$1733AFDA2BB3B0E8,
+    $F34B37458BB86399,$8993478DBB8DEAE0,$06FBD6D5EBD3716B,$7C23A61DDBE6F812,$3373D23613F9D516,$49ABA2FE23CC5C6F,
+    $C6C333A67392C7E4,$BC1B436E43A74E9D,$95AC9329AC4BC9B5,$EF74E3E19C7E40CC,$601C72B9CC20DB47,$1AC40271FC15523E,
+    $5594765A340A7F3A,$2F4C0692043FF643,$A02497CA54616DC8,$DAFCE7026454E4B1,$3E847F9DC45F37C0,$445C0F55F46ABEB9,
+    $CB349E0DA4342532,$B1ECEEC59401AC4B,$FEBC9AEE5C1E814F,$8464EA266C2B0836,$0B0C7B7E3C7593BD,$71D40BB60C401AC4,
+    $E8A46C1224F5A634,$927C1CDA14C02F4D,$1D148D82449EB4C6,$67CCFD4A74AB3DBF,$289C8961BCB410BB,$5244F9A98C8199C2,
+    $DD2C68F1DCDF0249,$A7F41839ECEA8B30,$438C80A64CE15841,$3954F06E7CD4D138,$B63C61362C8A4AB3,$CCE411FE1CBFC3CA,
+    $83B465D5D4A0EECE,$F96C151DE49567B7,$76048445B4CBFC3C,$0CDCF48D84FE7545,$6FBD6D5EBD3716B7,$15651D968D029FCE,
+    $9A0D8CCEDD5C0445,$E0D5FC06ED698D3C,$AF85882D2576A038,$D55DF8E515432941,$5A3569BD451DB2CA,$20ED197575283BB3,
+    $C49581EAD523E8C2,$BE4DF122E51661BB,$3125607AB548FA30,$4BFD10B2857D7349,$04AD64994D625E4D,$7E7514517D57D734,
+    $F11D85092D094CBF,$8BC5F5C11D3CC5C6,$12B5926535897936,$686DE2AD05BCF04F,$E70573F555E26BC4,$9DDD033D65D7E2BD,
+    $D28D7716ADC8CFB9,$A85507DE9DFD46C0,$273D9686CDA3DD4B,$5DE5E64EFD965432,$B99D7ED15D9D8743,$C3450E196DA80E3A,
+    $4C2D9F413DF695B1,$36F5EF890DC31CC8,$79A59BA2C5DC31CC,$037DEB6AF5E9B8B5,$8C157A32A5B7233E,$F6CD0AFA9582AA47,
+    $4AD64994D625E4DA,$300E395CE6106DA3,$BF66A804B64EF628,$C5BED8CC867B7F51,$8AEEACE74E645255,$F036DC2F7E51DB2C,
+    $7F5E4D772E0F40A7,$05863DBF1E3AC9DE,$E1FEA520BE311AAF,$9B26D5E88E0493D6,$144E44B0DE5A085D,$6E963478EE6F8124,
+    $21C640532670AC20,$5B1E309B16452559,$D476A1C3461BBED2,$AEAED10B762E37AB,$37DEB6AF5E9B8B5B,$4D06C6676EAE0222,
+    $C26E573F3EF099A9,$B8B627F70EC510D0,$F7E653DCC6DA3DD4,$8D3E2314F6EFB4AD,$0256B24CA6B12F26,$788EC2849684A65F,
+    $9CF65A1B368F752E,$E62E2AD306BAFC57,$6946BB8B56E467DC,$139ECB4366D1EEA5,$5CCEBF68AECEC3A1,$2616CFA09EFB4AD8,
+    $A97E5EF8CEA5D153,$D3A62E30FE90582A,$B0C7B7E3C7593BD8,$CA1FC72BF76CB2A1,$45775673A732292A,$3FAF26BB9707A053,
+    $70FF52905F188D57,$0A2722586F2D042E,$854FB3003F739FA5,$FF97C3C80F4616DC,$1BEF5B57AF4DC5AD,$61372B9F9F784CD4,
+    $EE5FBAC7CF26D75F,$9487CA0FFF135E26,$DBD7BE24370C7322,$A10FCEEC0739FA5B,$2E675FB4576761D0,$54BF2F7C6752E8A9,
+    $CDCF48D84FE75459,$B71738107FD2DD20,$387FA9482F8C46AB,$42A7D9801FB9CFD2,$0DF7ADABD7A6E2D6,$772FDD63E7936BAF,
+    $F8474C3BB7CDF024,$829F3CF387F8795D,$66E7A46C27F3AA2C,$1C3FD4A417C62355,$935745FC4798B8DE,$E98F353477AD31A7,
+    $A6DF411FBFB21CA3,$DC0731D78F8795DA,$536FA08FDFD90E51,$29B7D047EFEC8728
+  );
+
+{$ENDIF}
+
+function get_crc64_table : {const} PQWord;
+begin
+{$ifdef DYNAMIC_CRC_TABLE}
+  if (crc64_table_empty) then
+    make_crc64_table;
+{$endif}
+  get_crc64_table :=  {const} PQWord(@crc64_table);
+end;
+
+{void crc64(char *seq, char *res)
+
+    int i, j, low, high;
+    unsigned long long crc = INITIALCRC, part;
+    static int init = 0;
+    static unsigned long long CRCTable[256];
+
+
+    while (*seq)
+	crc = CRCTable[(crc ^ *seq++) & 0xff] ^ (crc >> 8);
+
+    /*
+     The output is done in two parts to avoid problems with
+     architecture-dependent word order
+     */
+    low = crc & 0xffffffff;
+    high = (crc >> 32) & 0xffffffff;
+    sprintf (res, "%08X%08X", high, low);
+
+    return;
+}
+function crc64(crc: qword; buf: Pbyte; len: cardinal): qword;
+begin
+  if (buf = nil) then
+    exit(INITIALCRC);
+
+{$IFDEF DYNAMIC_CRC_TABLE}
+  if crc64_table_empty then
+    make_crc64_table;
+{$ENDIF}
+
+  while (len >= 8) do
+  begin
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    dec(len, 8);
+  end;
+
+  if (len <> 0) then
+  repeat
+    crc := crc64_table[(crc xor buf^) and $ff] xor (crc shr 8);
+    inc(buf);
+    dec(len);
+  until (len = 0);
+
+  result := crc;
 end;
 end;
 
 
 
 
-end.
+end.

+ 23 - 17
packages/hash/src/md5.pp

@@ -53,6 +53,7 @@ type
   PMDContext = ^TMDContext;
   PMDContext = ^TMDContext;
   TMDContext = record
   TMDContext = record
     Version : TMDVersion;
     Version : TMDVersion;
+    Hash    : procedure(Context: PMDContext; Buffer: Pointer);
     Align   : PtrUInt;
     Align   : PtrUInt;
     State   : array[0..3] of Cardinal;
     State   : array[0..3] of Cardinal;
     BufCnt  : QWord;
     BufCnt  : QWord;
@@ -104,16 +105,16 @@ function MDMatch(const Digest1, Digest2: TMDDigest): Boolean;
  ******************************************************************************)
  ******************************************************************************)
 
 
 procedure MD2Init(var Context: TMD2Context); inline;
 procedure MD2Init(var Context: TMD2Context); inline;
-procedure MD2Update(var Context: TMD2Context; var Buf; const BufLen: PtrUInt); inline;
-procedure MD2Final(var Context: TMD2Context; var Digest: TMD2Digest); inline;
+procedure MD2Update(var Context: TMD2Context; var Buf; const BufLen: PtrUInt); external name 'MD_UPDATE';
+procedure MD2Final(var Context: TMD2Context; var Digest: TMD2Digest); external name 'MD_FINAL';
 
 
 procedure MD4Init(var Context: TMD4Context); inline;
 procedure MD4Init(var Context: TMD4Context); inline;
-procedure MD4Update(var Context: TMD4Context; var Buf; const BufLen: PtrUInt); inline;
-procedure MD4Final(var Context: TMD4Context; var Digest: TMD4Digest); inline;
+procedure MD4Update(var Context: TMD4Context; var Buf; const BufLen: PtrUInt); external name 'MD_UPDATE';
+procedure MD4Final(var Context: TMD4Context; var Digest: TMD4Digest); external name 'MD_FINAL';
 
 
 procedure MD5Init(var Context: TMD5Context); inline;
 procedure MD5Init(var Context: TMD5Context); inline;
-procedure MD5Update(var Context: TMD5Context; var Buf; const BufLen: PtrUInt); inline;
-procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest); inline;
+procedure MD5Update(var Context: TMD5Context; var Buf; const BufLen: PtrUInt); external name 'MD_UPDATE';
+procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest); external name 'MD_FINAL';
 
 
 
 
 (******************************************************************************
 (******************************************************************************
@@ -121,15 +122,15 @@ procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest); inline;
  ******************************************************************************)
  ******************************************************************************)
 
 
 function MD2String(const S: String): TMD2Digest; inline;
 function MD2String(const S: String): TMD2Digest; inline;
-function MD2Buffer(var Buf; const BufLen: PtrUInt): TMD2Digest; inline;
+function MD2Buffer(var Buf; const BufLen: PtrUInt): TMD2Digest;
 function MD2File(const Filename: String; const Bufsize: PtrUInt = MDDefBufSize): TMD2Digest; inline;
 function MD2File(const Filename: String; const Bufsize: PtrUInt = MDDefBufSize): TMD2Digest; inline;
 
 
 function MD4String(const S: String): TMD4Digest; inline;
 function MD4String(const S: String): TMD4Digest; inline;
-function MD4Buffer(var Buf; const BufLen: PtrUInt): TMD4Digest; inline;
+function MD4Buffer(var Buf; const BufLen: PtrUInt): TMD4Digest;
 function MD4File(const Filename: String; const Bufsize: PtrUInt = MDDefBufSize): TMD4Digest; inline;
 function MD4File(const Filename: String; const Bufsize: PtrUInt = MDDefBufSize): TMD4Digest; inline;
 
 
 function MD5String(const S: String): TMD5Digest; inline;
 function MD5String(const S: String): TMD5Digest; inline;
-function MD5Buffer(var Buf; const BufLen: PtrUInt): TMD5Digest; inline;
+function MD5Buffer(var Buf; const BufLen: PtrUInt): TMD5Digest;
 function MD5File(const Filename: String; const Bufsize: PtrUInt = MDDefBufSize): TMD5Digest; inline;
 function MD5File(const Filename: String; const Bufsize: PtrUInt = MDDefBufSize): TMD5Digest; inline;
 
 
 
 
@@ -362,6 +363,10 @@ begin
 
 
     MD_VERSION_4, MD_VERSION_5:
     MD_VERSION_4, MD_VERSION_5:
       begin
       begin
+        {if Version = MD_VERSION_4 then
+          Context.Hash := @MD4Transform
+        else
+          Context.Hash := @MD5Transform;}
         Context.Align := 64;
         Context.Align := 64;
         Context.State[0] := $67452301;
         Context.State[0] := $67452301;
         Context.State[1] := $efcdab89;
         Context.State[1] := $efcdab89;
@@ -374,13 +379,14 @@ begin
     MD_VERSION_2:
     MD_VERSION_2:
       begin
       begin
         Context.Align := 16;
         Context.Align := 16;
+        //Context.Hash := @@MD2Transform
       end;
       end;
 
 
   end;
   end;
 end;
 end;
 
 
 
 
-procedure MDUpdate(var Context: TMDContext; var Buf; const BufLen: PtrUInt);
+procedure MDUpdate(var Context: TMDContext; var Buf; const BufLen: PtrUInt); [public,alias:'MD_UPDATE'];
 var
 var
   Align: PtrUInt;
   Align: PtrUInt;
   Src: Pointer;
   Src: Pointer;
@@ -439,7 +445,7 @@ begin
 end;
 end;
 
 
 
 
-procedure MDFinal(var Context: TMDContext; var Digest: TMDDigest);
+procedure MDFinal(var Context: TMDContext; var Digest: TMDDigest); [public,alias:'MD_FINAL'];
 const
 const
 {$ifdef FPC_BIG_ENDIAN}
 {$ifdef FPC_BIG_ENDIAN}
   PADDING_MD45: array[0..15] of Cardinal = ($80000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
   PADDING_MD45: array[0..15] of Cardinal = ($80000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
@@ -564,7 +570,7 @@ begin
   MDInit(Context, MD_VERSION_2);
   MDInit(Context, MD_VERSION_2);
 end;
 end;
 
 
-procedure MD2Update(var Context: TMD2Context; var Buf; const BufLen: PtrUInt);
+{procedure MD2Update(var Context: TMD2Context; var Buf; const BufLen: PtrUInt);
 begin
 begin
   MDUpdate(Context, Buf, BufLen);
   MDUpdate(Context, Buf, BufLen);
 end;
 end;
@@ -572,14 +578,14 @@ end;
 procedure MD2Final(var Context: TMD2Context; var Digest: TMD2Digest);
 procedure MD2Final(var Context: TMD2Context; var Digest: TMD2Digest);
 begin
 begin
   MDFinal(Context, Digest);
   MDFinal(Context, Digest);
-end;
+end;}
 
 
 procedure MD4Init(var Context: TMD4Context);
 procedure MD4Init(var Context: TMD4Context);
 begin
 begin
   MDInit(Context, MD_VERSION_4);
   MDInit(Context, MD_VERSION_4);
 end;
 end;
 
 
-procedure MD4Update(var Context: TMD4Context; var Buf; const BufLen: PtrUInt);
+{procedure MD4Update(var Context: TMD4Context; var Buf; const BufLen: PtrUInt);
 begin
 begin
   MDUpdate(Context, Buf, BufLen);
   MDUpdate(Context, Buf, BufLen);
 end;
 end;
@@ -587,14 +593,14 @@ end;
 procedure MD4Final(var Context: TMD4Context; var Digest: TMD4Digest);
 procedure MD4Final(var Context: TMD4Context; var Digest: TMD4Digest);
 begin
 begin
   MDFinal(Context, Digest);
   MDFinal(Context, Digest);
-end;
+end;}
 
 
 procedure MD5Init(var Context: TMD5Context);
 procedure MD5Init(var Context: TMD5Context);
 begin
 begin
   MDInit(Context, MD_VERSION_5);
   MDInit(Context, MD_VERSION_5);
 end;
 end;
 
 
-procedure MD5Update(var Context: TMD5Context; var Buf; const BufLen: PtrUInt);
+{procedure MD5Update(var Context: TMD5Context; var Buf; const BufLen: PtrUInt);
 begin
 begin
   MDUpdate(Context, Buf, BufLen);
   MDUpdate(Context, Buf, BufLen);
 end;
 end;
@@ -602,7 +608,7 @@ end;
 procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest);
 procedure MD5Final(var Context: TMD5Context; var Digest: TMD5Digest);
 begin
 begin
   MDFinal(Context, Digest);
   MDFinal(Context, Digest);
-end;
+end;}
 
 
 function MD2String(const S: String): TMD2Digest;
 function MD2String(const S: String): TMD2Digest;
 begin
 begin