TSecHash :
**********

   Version 0.02 by Frank Kroeger (FKroeger@tkc.de)


   A component to generate a condensed representation of a message called
   message digest using the Secure Hash Standard-1 (SHA-1).

   SHA-1 has been developed by the NIST (National Institut of Standards and
   Technology) and been published in FIP-180 (Federal Information Processing
   Standards Publication 180)

   SHA-1 produces a 160-Bit output (the message digest) of a message or a
   data file. SHA-1 is called secure because it is computationally
   infeasible to find a message corresponding to a given message digest or
   to find a second (different) message which produces the same message
   digest.


History:
********

   08.06.1998: - new release version 0.03
               - procedure SHA now declared as assembler without local
                 variables
               - restructuring of assembler code and functions ComputeString
                 and ComputeMem
                 thanks to Kovacs Attila Zoltan (kaz@freemail.c3.hu)

   03.06.1998: - new release version 0.02
               - fixed bug when last data block holds less than 56 bytes
                 ( thanks to        Ivan Saorin (isscsi@tin.it) and
                                    Jevgenij Gorbunov (gorbunov@med.muni.cz)
                   for pointing this out)
               - some changes in the assembler code

   01.05.1998: - First release


Installation:
*************

   This component was designed for Delphi 3.x but should also work with
   Delphi 2.x.
   Simply unzip the distribution file to any directory on your harddrive
   and install it into your component palette.
   (usually Component/Install..)


Usage:
******

   The unit SecHash defines following types:

   TIntDigest  : Array[0..4] of integer;
   TByteDigest : Array[0..19] of byte;


   TSecHash provides 3 functions to compute the message digest.
   These are:

   function ComputeString(msg:String):TIntDigest;
   function ComputeFile(FileName:String):TIntDigest;
   function ComputeMem(memPtr:pointer;length:Integer):TIntDigest;

   All of these functions return an array of 5 integer values holding the
   message digest. (These are the 160-Bits of the digest)
   The MSB of IntDigest[0] holds the MSB of the digest and the LSB of
   IntDigest[4] holds the LSB of the digest.

   Look at the example for further information.



   If you need the digest in a byte array rather than in an integer array
   you can pass the returned integer array to the function

   function intDigestToByteDigest(intDigest:TIntDigest):TByteDigest;

   The MSB of ByteDigest[0] holds the MSB of the digest and the LSB of
   ByteDigest[19] holds the LSB of the digest.



Copyright:
**********

   This component is copyright by Frank Kroeger (FKroeger@tkc.de)



License agreement:
******************

   THIS SOFTWARE AND THE ACCOMPANYING FILES ARE FREEWARE AND
   WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY
   OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED.  Because of the
   various hardware and software environments into which TSecHash
   may be put, NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS
   OFFERED.

   Good data processing procedure dictates that any program be
   thoroughly tested with non-critical data before relying on it. The
   user must assume the entire risk of using the program. BECAUSE THIS
   PRODUCT IS GIVEN TO YOU AS "FREEWARE" THERE WILL BE NO LIABILITY
   OF THE AUTHOR. SHOULD THE USE OF THIS SOFTWARE RESULT IN ANY DAMAGES
   OF HARDWARE, SOFTWARE OR DATA THE AUTHOR CAN NOT BE HELD RESPONSIBLE
   FOR THIS.

   The export of programs using this algorithm might be restricted by the
   US government. Any citizen of the USA should contact the State
   Department's Office of Defense Trade Controls before they try to export
   programs using SHA-1.


Patents:
********

   Implementations using this component may be covered by U.S. and other
   patents. The user of this component is responsible to make sure he is
   not violating any patents by using SHA-1.


Example:
********

   The included example calculates the message digest for the three test
   vectors published by the NIST. These test vectors and corresponding
   message results are:

   Test Vector   : abc
   Message Digest: A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D

   Test Vector   : abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq
   Message Digest: 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670E1

   Test vector   : 1 million repetitions of 'a'
   Message Digest: 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F



Author:
*******

   Frank Kroeger

   FKroeger@tkc.de
