xref: /PHP-8.0/ext/hash/php_hash_md.h (revision ada776c8)
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    | http://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 PHP_HASH_API void PHP_MD4Init(PHP_MD4_CTX *);
32 PHP_HASH_API void PHP_MD4Update(PHP_MD4_CTX *context, const unsigned char *, size_t);
33 PHP_HASH_API void PHP_MD4Final(unsigned char[16], PHP_MD4_CTX *);
34 
35 /* MD2 context */
36 typedef struct {
37 	unsigned char state[48];
38 	unsigned char checksum[16];
39 	unsigned char buffer[16];
40 	unsigned char in_buffer;
41 } PHP_MD2_CTX;
42 #define PHP_MD2_SPEC "b48b16b16b."
43 
44 PHP_HASH_API void PHP_MD2Init(PHP_MD2_CTX *context);
45 PHP_HASH_API void PHP_MD2Update(PHP_MD2_CTX *context, const unsigned char *, size_t);
46 PHP_HASH_API void PHP_MD2Final(unsigned char[16], PHP_MD2_CTX *);
47 
48 #endif
49