Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit sha;
- interface
- {
- Automatically converted by H2Pas 1.0.0 from sha.h
- The following command line parameters were used:
- -t
- -p
- -l
- -v
- sha.h
- }
- { Pointers to basic pascal types, inserted by h2pas conversion program.}
- Type
- PLongint = ^Longint;
- PSmallInt = ^SmallInt;
- PByte = ^Byte;
- PWord = ^Word;
- PDWord = ^DWord;
- PDouble = ^Double;
- Type
- Pbyte = ^byte;
- PSHA256_CTX = ^SHA256_CTX;
- PSHA256state_st = ^SHA256state_st;
- PSHA512_CTX = ^SHA512_CTX;
- PSHA512state_st = ^SHA512state_st;
- PSHA_CTX = ^SHA_CTX;
- PSHAstate_st = ^SHAstate_st;
- {$IFDEF FPC}
- {$PACKRECORDS C}
- {$ENDIF}
- { crypto/sha/sha.h }
- { Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay@cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the library
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- * the apps directory (application code) you must include an acknowledgement:
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed. i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- }
- {
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !
- * ! SHA_LONG_LOG2 has to be defined along. !
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
- const
- SHA_LONG = dword;
- SHA_LBLOCK = 16;
- (* error
- #define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a
- { SHA treats input data as a
- * contiguous array of 32 bit
- * wide big-endian values. }
- in define line 76 *)
- SHA_LAST_BLOCK = SHA_CBLOCK-8;
- SHA_DIGEST_LENGTH = 20;
- type
- PSHAstate_st = ^TSHAstate_st;
- TSHAstate_st = record
- h0 : TSHA_LONG;
- h1 : TSHA_LONG;
- h2 : TSHA_LONG;
- h3 : TSHA_LONG;
- h4 : TSHA_LONG;
- Nl : TSHA_LONG;
- Nh : TSHA_LONG;
- data : array[0..(SHA_LBLOCK)-1] of TSHA_LONG;
- num : dword;
- end;
- TSHA_CTX = TSHAstate_st;
- PSHA_CTX = ^TSHA_CTX;
- function SHA_Init(c:PSHA_CTX):longint;
- (* Const before type ignored *)
- function SHA_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
- function SHA_Final(md:Pbyte; c:PSHA_CTX):longint;
- (* Const before type ignored *)
- function SHA(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- (* Const before type ignored *)
- procedure SHA_Transform(c:PSHA_CTX; data:Pbyte);
- function SHA1_Init(c:PSHA_CTX):longint;
- (* Const before type ignored *)
- function SHA1_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
- function SHA1_Final(md:Pbyte; c:PSHA_CTX):longint;
- (* Const before type ignored *)
- function SHA1(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- (* Const before type ignored *)
- procedure SHA1_Transform(c:PSHA_CTX; data:Pbyte);
- (* error
- #define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a
- { SHA-256 treats input data as a
- * contiguous array of 32 bit
- * wide big-endian values. }
- in define line 101 *)
- const
- SHA224_DIGEST_LENGTH = 28;
- SHA256_DIGEST_LENGTH = 32;
- type
- PSHA256state_st = ^TSHA256state_st;
- TSHA256state_st = record
- h : array[0..7] of TSHA_LONG;
- Nl : TSHA_LONG;
- Nh : TSHA_LONG;
- data : array[0..(SHA_LBLOCK)-1] of TSHA_LONG;
- num : dword;
- md_len : dword;
- end;
- TSHA256_CTX = TSHA256state_st;
- PSHA256_CTX = ^TSHA256_CTX;
- function SHA224_Init(c:PSHA256_CTX):longint;
- (* Const before type ignored *)
- function SHA224_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
- function SHA224_Final(md:Pbyte; c:PSHA256_CTX):longint;
- (* Const before type ignored *)
- function SHA224(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- function SHA256_Init(c:PSHA256_CTX):longint;
- (* Const before type ignored *)
- function SHA256_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
- function SHA256_Final(md:Pbyte; c:PSHA256_CTX):longint;
- (* Const before type ignored *)
- function SHA256(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- (* Const before type ignored *)
- procedure SHA256_Transform(c:PSHA256_CTX; data:Pbyte);
- const
- SHA384_DIGEST_LENGTH = 48;
- SHA512_DIGEST_LENGTH = 64;
- {
- * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
- * being exactly 64-bit wide. See Implementation Notes in sha512.c
- * for further details.
- }
- (* error
- #define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a
- { SHA-512 treats input data as a
- * contiguous array of 64 bit
- * wide big-endian values. }
- in define line 133 *)
- SHA_LONG64 = qword;
- (* error
- #define U64(C) C##ULL
- in define line 135 *)
- type
- PSHA512state_st = ^TSHA512state_st;
- TSHA512state_st = record
- h : array[0..7] of TSHA_LONG64;
- Nl : TSHA_LONG64;
- Nh : TSHA_LONG64;
- u : record
- case longint of
- 0 : ( d : array[0..(SHA_LBLOCK)-1] of TSHA_LONG64 );
- 1 : ( p : array[0..(SHA512_CBLOCK)-1] of byte );
- end;
- num : dword;
- md_len : dword;
- end;
- TSHA512_CTX = TSHA512state_st;
- PSHA512_CTX = ^TSHA512_CTX;
- function SHA384_Init(c:PSHA512_CTX):longint;
- (* Const before type ignored *)
- function SHA384_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
- function SHA384_Final(md:Pbyte; c:PSHA512_CTX):longint;
- (* Const before type ignored *)
- function SHA384(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- function SHA512_Init(c:PSHA512_CTX):longint;
- (* Const before type ignored *)
- function SHA512_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
- function SHA512_Final(md:Pbyte; c:PSHA512_CTX):longint;
- (* Const before type ignored *)
- function SHA512(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- (* Const before type ignored *)
- procedure SHA512_Transform(c:PSHA512_CTX; data:Pbyte);
- implementation
- function SHA_Init(c:PSHA_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
- begin
- { You must implement this function }
- end;
- function SHA_Final(md:Pbyte; c:PSHA_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- begin
- { You must implement this function }
- end;
- procedure SHA_Transform(c:PSHA_CTX; data:Pbyte);
- begin
- { You must implement this function }
- end;
- function SHA1_Init(c:PSHA_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA1_Update(c:PSHA_CTX; data:pointer; len:Tsize_t):longint;
- begin
- { You must implement this function }
- end;
- function SHA1_Final(md:Pbyte; c:PSHA_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA1(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- begin
- { You must implement this function }
- end;
- procedure SHA1_Transform(c:PSHA_CTX; data:Pbyte);
- begin
- { You must implement this function }
- end;
- function SHA224_Init(c:PSHA256_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA224_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
- begin
- { You must implement this function }
- end;
- function SHA224_Final(md:Pbyte; c:PSHA256_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA224(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- begin
- { You must implement this function }
- end;
- function SHA256_Init(c:PSHA256_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA256_Update(c:PSHA256_CTX; data:pointer; len:Tsize_t):longint;
- begin
- { You must implement this function }
- end;
- function SHA256_Final(md:Pbyte; c:PSHA256_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA256(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- begin
- { You must implement this function }
- end;
- procedure SHA256_Transform(c:PSHA256_CTX; data:Pbyte);
- begin
- { You must implement this function }
- end;
- function SHA384_Init(c:PSHA512_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA384_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
- begin
- { You must implement this function }
- end;
- function SHA384_Final(md:Pbyte; c:PSHA512_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA384(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- begin
- { You must implement this function }
- end;
- function SHA512_Init(c:PSHA512_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA512_Update(c:PSHA512_CTX; data:pointer; len:Tsize_t):longint;
- begin
- { You must implement this function }
- end;
- function SHA512_Final(md:Pbyte; c:PSHA512_CTX):longint;
- begin
- { You must implement this function }
- end;
- function SHA512(d:Pbyte; n:Tsize_t; md:Pbyte):Pbyte;
- begin
- { You must implement this function }
- end;
- procedure SHA512_Transform(c:PSHA512_CTX; data:Pbyte);
- begin
- { You must implement this function }
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement