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