root/ext/hash/php_hash_sha.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 7                                                        |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1997-2016 The PHP Group                                |
   6    +----------------------------------------------------------------------+
   7    | This source file is subject to version 3.01 of the PHP license,      |
   8    | that is bundled with this package in the file LICENSE, and is        |
   9    | available through the world-wide-web at the following url:           |
  10    | http://www.php.net/license/3_01.txt                                  |
  11    | If you did not receive a copy of the PHP license and are unable to   |
  12    | obtain it through the world-wide-web, please send a note to          |
  13    | license@php.net so we can mail you a copy immediately.               |
  14    +----------------------------------------------------------------------+
  15    | SHA1 Author: Stefan Esser <sesser@php.net>                           |
  16    | SHA256 Author: Sara Golemon <pollita@php.net>                        |
  17    +----------------------------------------------------------------------+
  18 */
  19 
  20 /* $Id$ */
  21 
  22 #ifndef PHP_HASH_SHA_H
  23 #define PHP_HASH_SHA_H
  24 
  25 /* When SHA is removed from Core,
  26         the ext/standard/sha1.c file can be removed
  27         and the ext/standard/sha1.h file can be reduced to:
  28                 #define PHP_HASH_SHA1_NOT_IN_CORE
  29                 #include "ext/hash/php_hash_sha.h"
  30         Don't forget to remove sha1() and sha1_file() from basic_functions.c
  31  */
  32 #include "ext/standard/sha1.h"
  33 #include "ext/standard/basic_functions.h"
  34 
  35 #ifdef PHP_HASH_SHA1_NOT_IN_CORE
  36 
  37 /* SHA1 context. */
  38 typedef struct {
  39         php_hash_uint32 state[5];               /* state (ABCD) */
  40         php_hash_uint32 count[2];               /* number of bits, modulo 2^64 */
  41         unsigned char buffer[64];       /* input buffer */
  42 } PHP_SHA1_CTX;
  43 
  44 PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX *);
  45 PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, unsigned int);
  46 PHP_HASH_API void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
  47 
  48 PHP_FUNCTION(sha1);
  49 PHP_FUNCTION(sha1_file);
  50 
  51 #endif /* PHP_HASH_SHA1_NOT_IN_CORE */
  52 
  53 /* SHA224 context. */
  54 typedef struct {
  55         php_hash_uint32 state[8];               /* state */
  56         php_hash_uint32 count[2];               /* number of bits, modulo 2^64 */
  57         unsigned char buffer[64];       /* input buffer */
  58 } PHP_SHA224_CTX;
  59 
  60 PHP_HASH_API void PHP_SHA224Init(PHP_SHA224_CTX *);
  61 PHP_HASH_API void PHP_SHA224Update(PHP_SHA224_CTX *, const unsigned char *, unsigned int);
  62 PHP_HASH_API void PHP_SHA224Final(unsigned char[28], PHP_SHA224_CTX *);
  63 
  64 /* SHA256 context. */
  65 typedef struct {
  66         php_hash_uint32 state[8];               /* state */
  67         php_hash_uint32 count[2];               /* number of bits, modulo 2^64 */
  68         unsigned char buffer[64];       /* input buffer */
  69 } PHP_SHA256_CTX;
  70 
  71 PHP_HASH_API void PHP_SHA256Init(PHP_SHA256_CTX *);
  72 PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *, const unsigned char *, unsigned int);
  73 PHP_HASH_API void PHP_SHA256Final(unsigned char[32], PHP_SHA256_CTX *);
  74 
  75 /* SHA384 context */
  76 typedef struct {
  77         php_hash_uint64 state[8];       /* state */
  78         php_hash_uint64 count[2];       /* number of bits, modulo 2^128 */
  79         unsigned char buffer[128];      /* input buffer */
  80 } PHP_SHA384_CTX;
  81 
  82 PHP_HASH_API void PHP_SHA384Init(PHP_SHA384_CTX *);
  83 PHP_HASH_API void PHP_SHA384Update(PHP_SHA384_CTX *, const unsigned char *, unsigned int);
  84 PHP_HASH_API void PHP_SHA384Final(unsigned char[48], PHP_SHA384_CTX *);
  85 
  86 /* SHA512 context */
  87 typedef struct {
  88         php_hash_uint64 state[8];       /* state */
  89         php_hash_uint64 count[2];       /* number of bits, modulo 2^128 */
  90         unsigned char buffer[128];      /* input buffer */
  91 } PHP_SHA512_CTX;
  92 
  93 PHP_HASH_API void PHP_SHA512Init(PHP_SHA512_CTX *);
  94 PHP_HASH_API void PHP_SHA512Update(PHP_SHA512_CTX *, const unsigned char *, unsigned int);
  95 PHP_HASH_API void PHP_SHA512Final(unsigned char[64], PHP_SHA512_CTX *);
  96 
  97 #endif /* PHP_HASH_SHA_H */

/* [<][>][^][v][top][bottom][index][help] */