xref: /PHP-7.4/ext/hash/php_hash_sha3.h (revision 92ac598a)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 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    | Author: Sara Golemon <pollita@php.net>                               |
16    +----------------------------------------------------------------------+
17 */
18 
19 #ifndef PHP_HASH_SHA3_H
20 #define PHP_HASH_SHA3_H
21 
22 #include "php.h"
23 
24 typedef struct {
25 #ifdef HAVE_SLOW_HASH3
26 	unsigned char state[200]; // 5 * 5 * sizeof(uint64)
27 	uint32_t pos;
28 #else
29 	void *hashinstance;
30 #endif
31 } PHP_SHA3_CTX;
32 
33 typedef PHP_SHA3_CTX PHP_SHA3_224_CTX;
34 typedef PHP_SHA3_CTX PHP_SHA3_256_CTX;
35 typedef PHP_SHA3_CTX PHP_SHA3_384_CTX;
36 typedef PHP_SHA3_CTX PHP_SHA3_512_CTX;
37 
38 PHP_HASH_API void PHP_SHA3224Init(PHP_SHA3_224_CTX*);
39 PHP_HASH_API void PHP_SHA3224Update(PHP_SHA3_224_CTX*, const unsigned char*, size_t);
40 PHP_HASH_API void PHP_SAH3224Final(unsigned char[32], PHP_SHA3_224_CTX*);
41 
42 PHP_HASH_API void PHP_SHA3256Init(PHP_SHA3_256_CTX*);
43 PHP_HASH_API void PHP_SHA3256Update(PHP_SHA3_256_CTX*, const unsigned char*, size_t);
44 PHP_HASH_API void PHP_SAH3256Final(unsigned char[32], PHP_SHA3_256_CTX*);
45 
46 PHP_HASH_API void PHP_SHA3384Init(PHP_SHA3_384_CTX*);
47 PHP_HASH_API void PHP_SHA3384Update(PHP_SHA3_384_CTX*, const unsigned char*, size_t);
48 PHP_HASH_API void PHP_SAH3384Final(unsigned char[32], PHP_SHA3_384_CTX*);
49 
50 PHP_HASH_API void PHP_SHA3512Init(PHP_SHA3_512_CTX*);
51 PHP_HASH_API void PHP_SHA3512Update(PHP_SHA3_512_CTX*, const unsigned char*, size_t);
52 PHP_HASH_API void PHP_SAH3512Final(unsigned char[32], PHP_SHA3_512_CTX*);
53 
54 #endif
55