[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 8.14.9 ``MD5'` Message Digests

The following listing contains the interface of the MD5 unit.

This unit provides functions to compute ``MD5'` message digest of files or memory blocks, according to the definition of ``MD5'` in RFC 1321 from April 1992.

    { Functions to compute MD5 message digest of files or memory blocks,
      according to the definition of MD5 in RFC 1321 from April 1992.

      IMPORTANT NOTE: This unit is distributed under the GNU GPL, NOT
      under the GNU LGPL under which most of the other GPC units are
      distributed. This means that you must distribute any code that
      uses this unit under the GPL as well, which means that you have to
      make the source code available whenever you distribute a binary of
      the code, and that you must allow recipients to modify the code
      and redistribute it under the GPL.

      Copyright (C) 1995, 1996, 2000-2002 Free Software Foundation, Inc.

      Based on the C code written by Ulrich Drepper
      <drepper@gnu.ai.mit.edu>, 1995 as part of the GNU C Library.

      This file is part of GNU Pascal.

      GNU Pascal is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
      by the Free Software Foundation; either version 2, or (at your
      option) any later version.

      GNU Pascal is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with GNU Pascal; see the file COPYING. If not, write to the
      Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
      02111-1307, USA. }

    {$gnu-pascal,I-}
    {$if __GPC_RELEASE__ < 20001023}
    {$error This unit requires GPC release 20001023 or newer.}
    {$endif}

    unit MD5;

    interface

    uses GPC;

    { Representation of a MD5 value. It is always in little endian byte
      order and therefore portable. }
    type
      Card8 = Cardinal (8);
      TMD5 = array [1 .. 16] of Card8;

    { Computes MD5 message digest for Length bytes in Buffer. }
    procedure MD5Buffer (const Buffer; Length: SizeType; var MD5: TMD5);
      asmname '_p_md5_buffer';

    { Computes MD5 message digest for the contents of the file f. }
    { @@ iocritical } procedure MD5File (var f: File; var MD5: TMD5);
      asmname '_p_md5_file';

    { Initializes a MD5 value with zeros. }
    procedure MD5Clear (var MD5: TMD5); asmname '_p_md5_clear';

    { Compares two MD5 values for equality. }
    function MD5Compare (const Value1, Value2: TMD5): Boolean;
      asmname '_p_md5_compare';

    { Converts an MD5 value to a string. }
    function MD5Str ({ @@ fjf382 const } MD5: TMD5) = s: TString;
      asmname '_p_md5_str';

    { Converts a string to an MD5 value. Returns True if successful. }
    function MD5Val (const s: String; var MD5: TMD5): Boolean;
      asmname '_p_md5_val';

    { Composes two MD5 values to a single one. }
    function MD5Compose (const Value1, Value2: TMD5) = Dest: TMD5;
      asmname '_p_md5_compose';

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Frank Heckenbach on May, 10 2002 using texi2html