xref: /PHP-8.1/ext/hash/php_hash_md.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    | Original Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca>               |
14    | Modified for pHASH by: Sara Golemon <pollita@php.net>
15    +----------------------------------------------------------------------+
16 */
17 
18 #ifndef PHP_HASH_MD_H
19 #define PHP_HASH_MD_H
20 
21 #include "ext/standard/md5.h"
22 
23 /* MD4 context */
24 typedef struct {
25 	uint32_t state[4];
26 	uint32_t count[2];
27 	unsigned char buffer[64];
28 } PHP_MD4_CTX;
29 #define PHP_MD4_SPEC "l4l2b64."
30 
31 #define PHP_MD4Init(ctx) PHP_MD4InitArgs(ctx, NULL)
32 PHP_HASH_API void PHP_MD4InitArgs(PHP_MD4_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
33 PHP_HASH_API void PHP_MD4Update(PHP_MD4_CTX *context, const unsigned char *, size_t);
34 PHP_HASH_API void PHP_MD4Final(unsigned char[16], PHP_MD4_CTX *);
35 
36 /* MD2 context */
37 typedef struct {
38 	unsigned char state[48];
39 	unsigned char checksum[16];
40 	unsigned char buffer[16];
41 	unsigned char in_buffer;
42 } PHP_MD2_CTX;
43 #define PHP_MD2_SPEC "b48b16b16b."
44 
45 #define PHP_MD2Init(ctx) PHP_MD2InitArgs(ctx, NULL)
46 PHP_HASH_API void PHP_MD2InitArgs(PHP_MD2_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
47 PHP_HASH_API void PHP_MD2Update(PHP_MD2_CTX *context, const unsigned char *, size_t);
48 PHP_HASH_API void PHP_MD2Final(unsigned char[16], PHP_MD2_CTX *);
49 
50 #endif
51