xref: /PHP-7.3/ext/hash/php_hash_haval.h (revision 8d3f8ca1)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 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_HAVAL_H
20 #define PHP_HASH_HAVAL_H
21 
22 #include "ext/standard/basic_functions.h"
23 /* HAVAL context. */
24 typedef struct {
25 	uint32_t state[8];
26 	uint32_t count[2];
27 	unsigned char buffer[128];
28 
29 	char passes;
30 	short output;
31 	void (*Transform)(uint32_t state[8], const unsigned char block[128]);
32 } PHP_HAVAL_CTX;
33 
34 #define PHP_HASH_HAVAL_INIT_DECL(p,b)	PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *); \
35 										PHP_HASH_API void PHP_HAVAL##b##Final(unsigned char*, PHP_HAVAL_CTX *);
36 
37 PHP_HASH_API void PHP_HAVALUpdate(PHP_HAVAL_CTX *, const unsigned char *, unsigned int);
38 
39 PHP_HASH_HAVAL_INIT_DECL(3,128)
40 PHP_HASH_HAVAL_INIT_DECL(3,160)
41 PHP_HASH_HAVAL_INIT_DECL(3,192)
42 PHP_HASH_HAVAL_INIT_DECL(3,224)
43 PHP_HASH_HAVAL_INIT_DECL(3,256)
44 
45 PHP_HASH_HAVAL_INIT_DECL(4,128)
46 PHP_HASH_HAVAL_INIT_DECL(4,160)
47 PHP_HASH_HAVAL_INIT_DECL(4,192)
48 PHP_HASH_HAVAL_INIT_DECL(4,224)
49 PHP_HASH_HAVAL_INIT_DECL(4,256)
50 
51 PHP_HASH_HAVAL_INIT_DECL(5,128)
52 PHP_HASH_HAVAL_INIT_DECL(5,160)
53 PHP_HASH_HAVAL_INIT_DECL(5,192)
54 PHP_HASH_HAVAL_INIT_DECL(5,224)
55 PHP_HASH_HAVAL_INIT_DECL(5,256)
56 
57 #endif
58