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