xref: /PHP-8.4/ext/hash/php_hash_haval.h (revision 3813ad10)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Author: Sara Golemon <pollita@php.net>                               |
14    +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_HASH_HAVAL_H
18 #define PHP_HASH_HAVAL_H
19 
20 /* HAVAL context. */
21 typedef struct {
22 	uint32_t state[8];
23 	uint32_t count[2];
24 	unsigned char buffer[128];
25 
26 	char passes;
27 	short output;
28 	void (*Transform)(uint32_t state[8], const unsigned char block[128]);
29 } PHP_HAVAL_CTX;
30 #define PHP_HAVAL_SPEC "l8l2b128"
31 
32 #define PHP_HASH_HAVAL_INIT_DECL(p,b)	PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); \
33 										PHP_HASH_API void PHP_HAVAL##b##Final(unsigned char*, PHP_HAVAL_CTX *);
34 
35 PHP_HASH_API void PHP_HAVALUpdate(PHP_HAVAL_CTX *, const unsigned char *, size_t);
36 
37 PHP_HASH_HAVAL_INIT_DECL(3,128)
38 PHP_HASH_HAVAL_INIT_DECL(3,160)
39 PHP_HASH_HAVAL_INIT_DECL(3,192)
40 PHP_HASH_HAVAL_INIT_DECL(3,224)
41 PHP_HASH_HAVAL_INIT_DECL(3,256)
42 
43 PHP_HASH_HAVAL_INIT_DECL(4,128)
44 PHP_HASH_HAVAL_INIT_DECL(4,160)
45 PHP_HASH_HAVAL_INIT_DECL(4,192)
46 PHP_HASH_HAVAL_INIT_DECL(4,224)
47 PHP_HASH_HAVAL_INIT_DECL(4,256)
48 
49 PHP_HASH_HAVAL_INIT_DECL(5,128)
50 PHP_HASH_HAVAL_INIT_DECL(5,160)
51 PHP_HASH_HAVAL_INIT_DECL(5,192)
52 PHP_HASH_HAVAL_INIT_DECL(5,224)
53 PHP_HASH_HAVAL_INIT_DECL(5,256)
54 
55 #endif
56