Advertisement
Guest User

Untitled

a guest
Jul 15th, 2011
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 12.48 KB | None | 0 0
  1.  
  2. unit sha;
  3. interface
  4.  
  5. {
  6.   Automatically converted by H2Pas 1.0.0 from sha.h
  7.   The following command line parameters were used:
  8.     -t
  9.     -p
  10.     -l
  11.     -v
  12.     sha.h
  13. }
  14.  
  15.     { Pointers to basic pascal types, inserted by h2pas conversion program.}
  16.     Type
  17.       PLongint  = ^Longint;
  18.       PSmallInt = ^SmallInt;
  19.       PByte     = ^Byte;
  20.       PWord     = ^Word;
  21.       PDWord    = ^DWord;
  22.       PDouble   = ^Double;
  23.  
  24.     Type
  25.     Pbyte  = ^byte;
  26.     PSHA256_CTX  = ^SHA256_CTX;
  27.     PSHA256state_st  = ^SHA256state_st;
  28.     PSHA512_CTX  = ^SHA512_CTX;
  29.     PSHA512state_st  = ^SHA512state_st;
  30.     PSHA_CTX  = ^SHA_CTX;
  31.     PSHAstate_st  = ^SHAstate_st;
  32. {$IFDEF FPC}
  33. {$PACKRECORDS C}
  34. {$ENDIF}
  35.  
  36.  
  37.   { crypto/sha/sha.h  }
  38.   { Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  39.    * All rights reserved.
  40.    *
  41.    * This package is an SSL implementation written
  42.    * by Eric Young (eay@cryptsoft.com).
  43.    * The implementation was written so as to conform with Netscapes SSL.
  44.    *
  45.    * This library is free for commercial and non-commercial use as long as
  46.    * the following conditions are aheared to.  The following conditions
  47.    * apply to all code found in this distribution, be it the RC4, RSA,
  48.    * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  49.    * included with this distribution is covered by the same copyright terms
  50.    * except that the holder is Tim Hudson (tjh@cryptsoft.com).
  51.    *
  52.    * Copyright remains Eric Young's, and as such any Copyright notices in
  53.    * the code are not to be removed.
  54.    * If this package is used in a product, Eric Young should be given attribution
  55.    * as the author of the parts of the library used.
  56.    * This can be in the form of a textual message at program startup or
  57.    * in documentation (online or textual) provided with the package.
  58.    *
  59.    * Redistribution and use in source and binary forms, with or without
  60.    * modification, are permitted provided that the following conditions
  61.    * are met:
  62.    * 1. Redistributions of source code must retain the copyright
  63.    *    notice, this list of conditions and the following disclaimer.
  64.    * 2. Redistributions in binary form must reproduce the above copyright
  65.    *    notice, this list of conditions and the following disclaimer in the
  66.    *    documentation and/or other materials provided with the distribution.
  67.    * 3. All advertising materials mentioning features or use of this software
  68.    *    must display the following acknowledgement:
  69.    *    "This product includes cryptographic software written by
  70.    *     Eric Young (eay@cryptsoft.com)"
  71.    *    The word 'cryptographic' can be left out if the rouines from the library
  72.    *    being used are not cryptographic related :-).
  73.    * 4. If you include any Windows specific code (or a derivative thereof) from
  74.    *    the apps directory (application code) you must include an acknowledgement:
  75.    *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
  76.    *
  77.    * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  78.    * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  79.    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  80.    * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  81.    * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  82.    * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  83.    * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  84.    * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  85.    * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  86.    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  87.    * SUCH DAMAGE.
  88.    *
  89.    * The licence and distribution terms for any publically available version or
  90.    * derivative of this code cannot be changed.  i.e. this code cannot simply be
  91.    * copied and put under another distribution licence
  92.    * [including the GNU Public Licence.]
  93.     }
  94.   {
  95.    * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  96.    * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !
  97.    * ! SHA_LONG_LOG2 has to be defined along.                        !
  98.    * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  99.     }
  100.  
  101.   const
  102.     SHA_LONG = dword;    
  103.     SHA_LBLOCK = 16;    
  104. (* error
  105. #define SHA_CBLOCK  (SHA_LBLOCK*4) /* SHA treats input data as a
  106.   { SHA treats input data as a
  107.                      * contiguous array of 32 bit
  108.                      * wide big-endian values.  }
  109. in define line 76 *)
  110.       SHA_LAST_BLOCK = SHA_CBLOCK-8;      
  111.       SHA_DIGEST_LENGTH = 20;      
  112.  
  113.     type
  114.       PSHAstate_st = ^TSHAstate_st;
  115.       TSHAstate_st = record
  116.           h0 : TSHA_LONG;
  117.           h1 : TSHA_LONG;
  118.           h2 : TSHA_LONG;
  119.           h3 : TSHA_LONG;
  120.           h4 : TSHA_LONG;
  121.           Nl : TSHA_LONG;
  122.           Nh : TSHA_LONG;
  123.           data : array[0..(SHA_LBLOCK)-1] of TSHA_LONG;
  124.           num : dword;
  125.         end;
  126.       TSHA_CTX = TSHAstate_st;
  127.       PSHA_CTX = ^TSHA_CTX;
  128.  
  129.     function SHA_Init(c:PSHA_CTX):longint;
  130.  
  131. (* Const before type ignored *)
  132.     function SHA_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
  133.  
  134.     function SHA_Final(md:Pbyte; c:PSHA_CTX):longint;
  135.  
  136. (* Const before type ignored *)
  137.     function SHA(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  138.  
  139. (* Const before type ignored *)
  140.     procedure SHA_Transform(c:PSHA_CTX; data:Pbyte);
  141.  
  142.     function SHA1_Init(c:PSHA_CTX):longint;
  143.  
  144. (* Const before type ignored *)
  145.     function SHA1_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
  146.  
  147.     function SHA1_Final(md:Pbyte; c:PSHA_CTX):longint;
  148.  
  149. (* Const before type ignored *)
  150.     function SHA1(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  151.  
  152. (* Const before type ignored *)
  153.     procedure SHA1_Transform(c:PSHA_CTX; data:Pbyte);
  154.  
  155. (* error
  156. #define SHA256_CBLOCK   (SHA_LBLOCK*4)  /* SHA-256 treats input data as a
  157.     { SHA-256 treats input data as a
  158.                          * contiguous array of 32 bit
  159.                          * wide big-endian values.  }
  160. in define line 101 *)
  161.     const
  162.       SHA224_DIGEST_LENGTH = 28;      
  163.       SHA256_DIGEST_LENGTH = 32;      
  164.  
  165.     type
  166.       PSHA256state_st = ^TSHA256state_st;
  167.       TSHA256state_st = record
  168.           h : array[0..7] of TSHA_LONG;
  169.           Nl : TSHA_LONG;
  170.           Nh : TSHA_LONG;
  171.           data : array[0..(SHA_LBLOCK)-1] of TSHA_LONG;
  172.           num : dword;
  173.           md_len : dword;
  174.         end;
  175.       TSHA256_CTX = TSHA256state_st;
  176.       PSHA256_CTX = ^TSHA256_CTX;
  177.  
  178.     function SHA224_Init(c:PSHA256_CTX):longint;
  179.  
  180. (* Const before type ignored *)
  181.     function SHA224_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
  182.  
  183.     function SHA224_Final(md:Pbyte; c:PSHA256_CTX):longint;
  184.  
  185. (* Const before type ignored *)
  186.     function SHA224(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  187.  
  188.     function SHA256_Init(c:PSHA256_CTX):longint;
  189.  
  190. (* Const before type ignored *)
  191.     function SHA256_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
  192.  
  193.     function SHA256_Final(md:Pbyte; c:PSHA256_CTX):longint;
  194.  
  195. (* Const before type ignored *)
  196.     function SHA256(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  197.  
  198. (* Const before type ignored *)
  199.     procedure SHA256_Transform(c:PSHA256_CTX; data:Pbyte);
  200.  
  201.     const
  202.       SHA384_DIGEST_LENGTH = 48;      
  203.       SHA512_DIGEST_LENGTH = 64;      
  204.     {
  205.      * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
  206.      * being exactly 64-bit wide. See Implementation Notes in sha512.c
  207.      * for further details.
  208.       }
  209. (* error
  210. #define SHA512_CBLOCK   (SHA_LBLOCK*8)  /* SHA-512 treats input data as a
  211.     { SHA-512 treats input data as a
  212.                          * contiguous array of 64 bit
  213.                          * wide big-endian values.  }
  214. in define line 133 *)
  215.       SHA_LONG64 = qword;      
  216. (* error
  217. #define U64(C)     C##ULL
  218. in define line 135 *)
  219.  
  220.     type
  221.       PSHA512state_st = ^TSHA512state_st;
  222.       TSHA512state_st = record
  223.           h : array[0..7] of TSHA_LONG64;
  224.           Nl : TSHA_LONG64;
  225.           Nh : TSHA_LONG64;
  226.           u : record
  227.               case longint of
  228.                 0 : ( d : array[0..(SHA_LBLOCK)-1] of TSHA_LONG64 );
  229.                 1 : ( p : array[0..(SHA512_CBLOCK)-1] of byte );
  230.               end;
  231.           num : dword;
  232.           md_len : dword;
  233.         end;
  234.       TSHA512_CTX = TSHA512state_st;
  235.       PSHA512_CTX = ^TSHA512_CTX;
  236.  
  237.     function SHA384_Init(c:PSHA512_CTX):longint;
  238.  
  239. (* Const before type ignored *)
  240.     function SHA384_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
  241.  
  242.     function SHA384_Final(md:Pbyte; c:PSHA512_CTX):longint;
  243.  
  244. (* Const before type ignored *)
  245.     function SHA384(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  246.  
  247.     function SHA512_Init(c:PSHA512_CTX):longint;
  248.  
  249. (* Const before type ignored *)
  250.     function SHA512_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
  251.  
  252.     function SHA512_Final(md:Pbyte; c:PSHA512_CTX):longint;
  253.  
  254. (* Const before type ignored *)
  255.     function SHA512(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  256.  
  257. (* Const before type ignored *)
  258.     procedure SHA512_Transform(c:PSHA512_CTX; data:Pbyte);
  259.  
  260.  
  261. implementation
  262.  
  263.     function SHA_Init(c:PSHA_CTX):longint;
  264.     begin
  265.       { You must implement this function }
  266.     end;
  267.     function SHA_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
  268.     begin
  269.       { You must implement this function }
  270.     end;
  271.     function SHA_Final(md:Pbyte; c:PSHA_CTX):longint;
  272.     begin
  273.       { You must implement this function }
  274.     end;
  275.     function SHA(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  276.     begin
  277.       { You must implement this function }
  278.     end;
  279.     procedure SHA_Transform(c:PSHA_CTX; data:Pbyte);
  280.     begin
  281.       { You must implement this function }
  282.     end;
  283.     function SHA1_Init(c:PSHA_CTX):longint;
  284.     begin
  285.       { You must implement this function }
  286.     end;
  287.     function SHA1_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
  288.     begin
  289.       { You must implement this function }
  290.     end;
  291.     function SHA1_Final(md:Pbyte; c:PSHA_CTX):longint;
  292.     begin
  293.       { You must implement this function }
  294.     end;
  295.     function SHA1(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  296.     begin
  297.       { You must implement this function }
  298.     end;
  299.     procedure SHA1_Transform(c:PSHA_CTX; data:Pbyte);
  300.     begin
  301.       { You must implement this function }
  302.     end;
  303.     function SHA224_Init(c:PSHA256_CTX):longint;
  304.     begin
  305.       { You must implement this function }
  306.     end;
  307.     function SHA224_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
  308.     begin
  309.       { You must implement this function }
  310.     end;
  311.     function SHA224_Final(md:Pbyte; c:PSHA256_CTX):longint;
  312.     begin
  313.       { You must implement this function }
  314.     end;
  315.     function SHA224(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  316.     begin
  317.       { You must implement this function }
  318.     end;
  319.     function SHA256_Init(c:PSHA256_CTX):longint;
  320.     begin
  321.       { You must implement this function }
  322.     end;
  323.     function SHA256_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
  324.     begin
  325.       { You must implement this function }
  326.     end;
  327.     function SHA256_Final(md:Pbyte; c:PSHA256_CTX):longint;
  328.     begin
  329.       { You must implement this function }
  330.     end;
  331.     function SHA256(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  332.     begin
  333.       { You must implement this function }
  334.     end;
  335.     procedure SHA256_Transform(c:PSHA256_CTX; data:Pbyte);
  336.     begin
  337.       { You must implement this function }
  338.     end;
  339.     function SHA384_Init(c:PSHA512_CTX):longint;
  340.     begin
  341.       { You must implement this function }
  342.     end;
  343.     function SHA384_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
  344.     begin
  345.       { You must implement this function }
  346.     end;
  347.     function SHA384_Final(md:Pbyte; c:PSHA512_CTX):longint;
  348.     begin
  349.       { You must implement this function }
  350.     end;
  351.     function SHA384(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  352.     begin
  353.       { You must implement this function }
  354.     end;
  355.     function SHA512_Init(c:PSHA512_CTX):longint;
  356.     begin
  357.       { You must implement this function }
  358.     end;
  359.     function SHA512_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
  360.     begin
  361.       { You must implement this function }
  362.     end;
  363.     function SHA512_Final(md:Pbyte; c:PSHA512_CTX):longint;
  364.     begin
  365.       { You must implement this function }
  366.     end;
  367.     function SHA512(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
  368.     begin
  369.       { You must implement this function }
  370.     end;
  371.     procedure SHA512_Transform(c:PSHA512_CTX; data:Pbyte);
  372.     begin
  373.       { You must implement this function }
  374.     end;
  375.  
  376. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement