anchor.diff:  SHA1 test suit:
   procedure TForm1.Button1Click(Sender: TObject);
   const TEST1   = 'abc';
  -	TEST2a  = 'abcdbcdecdefdefgefghfghighijhi';
  +      TEST2a  = 'abcdbcdecdefdefgefghfghighijhi';
         TEST2b  = 'jkijkljklmklmnlmnomnopnopq';
         TEST2   = TEST2a + TEST2b;
         TEST3   = 'a';
  
positive.code: // Keyed SHA1 (HMAC-SHA1), RFC 2104
  
  
  procedure HMAC_SHA1( const Data; DataLen: Integer;
  			   const Key;  KeyLen : Integer;
  			   out   Digest       : SHA1Digest );
  var  k_ipad, k_opad: array[0..64] of Byte;
       Context: SHA1Context;
       i      : Integer;
  
negative.code: ------------------------------------------------------------------------------}
  
  
  unit Sha1;
  
  {$mode objfpc}{$H+}
  {$R-}
  {$Q-}
  
  interface
  
  uses SysUtils, Classes;
  
  const
    shaSuccess      = 0;
    shaNull         = 1;
    shaInputTooLong = 2;
    shaStateError   = 3;
    SHA1HashSize    = 20;
  
  type
    uint32_t      = Cardinal; // unsigned 32 bit integer
    uint8_t       = Byte;     // unsigned 8 bit integer (i.e., unsigned char)
    int_least16_t = LongInt;  // integer of >= 16 bits
  
    SHA1Digest = array[0..SHA1HashSize-1] of Char;
    SHA1DigestString = AnsiString;  // string containing 20 chars
  
    // This structure will hold context information for the SHA-1
    // hashing operation
    SHA1Context = record
      Intermediate_Hash: array[0..SHA1HashSize div 4-1] of uint32_t; // Message Digest
      Length_Low : uint32_t;                  // Message length in bits
      Length_High: uint32_t;                  // Message length in bits
      Message_Block_Index: int_least16_t;     // Index into message block array
      Message_Block: array[0..63] of uint8_t; // 512-bit message blocks
      Computed: Integer;                      // Is the digest computed?
      Corrupted: Integer;                     // Is the message digest corrupted?
    end;
  
  function SHA1Reset ( var context       : SHA1Context ): Integer;
  function SHA1Input ( var context       : SHA1Context;
                       message_array     : PChar;
                       length            : Cardinal ): Integer;
  function SHA1Result( var context       : SHA1Context;
                       var Message_Digest: SHA1Digest ): Integer;
  
  