xref: /PHP-7.4/ext/hash/php_hash_ripemd.h (revision 0cf7de1c)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 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_RIPEMD_H
20 #define PHP_HASH_RIPEMD_H
21 #include "ext/standard/basic_functions.h"
22 
23 /* RIPEMD context. */
24 typedef struct {
25 	uint32_t state[4];		/* state (ABCD) */
26 	uint32_t count[2];		/* number of bits, modulo 2^64 (lsb first) */
27 	unsigned char buffer[64];	/* input buffer */
28 } PHP_RIPEMD128_CTX;
29 
30 typedef struct {
31 	uint32_t state[5];		/* state (ABCD) */
32 	uint32_t count[2];		/* number of bits, modulo 2^64 (lsb first) */
33 	unsigned char buffer[64];	/* input buffer */
34 } PHP_RIPEMD160_CTX;
35 
36 typedef struct {
37 	uint32_t state[8];		/* state (ABCD) */
38 	uint32_t count[2];		/* number of bits, modulo 2^64 (lsb first) */
39 	unsigned char buffer[64];	/* input buffer */
40 } PHP_RIPEMD256_CTX;
41 
42 typedef struct {
43 	uint32_t state[10];		/* state (ABCD) */
44 	uint32_t count[2];		/* number of bits, modulo 2^64 (lsb first) */
45 	unsigned char buffer[64];	/* input buffer */
46 } PHP_RIPEMD320_CTX;
47 
48 PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX *);
49 PHP_HASH_API void PHP_RIPEMD128Update(PHP_RIPEMD128_CTX *, const unsigned char *, size_t);
50 PHP_HASH_API void PHP_RIPEMD128Final(unsigned char[16], PHP_RIPEMD128_CTX *);
51 
52 PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX *);
53 PHP_HASH_API void PHP_RIPEMD160Update(PHP_RIPEMD160_CTX *, const unsigned char *, size_t);
54 PHP_HASH_API void PHP_RIPEMD160Final(unsigned char[20], PHP_RIPEMD160_CTX *);
55 
56 PHP_HASH_API void PHP_RIPEMD256Init(PHP_RIPEMD256_CTX *);
57 PHP_HASH_API void PHP_RIPEMD256Update(PHP_RIPEMD256_CTX *, const unsigned char *, size_t);
58 PHP_HASH_API void PHP_RIPEMD256Final(unsigned char[32], PHP_RIPEMD256_CTX *);
59 
60 PHP_HASH_API void PHP_RIPEMD320Init(PHP_RIPEMD320_CTX *);
61 PHP_HASH_API void PHP_RIPEMD320Update(PHP_RIPEMD320_CTX *, const unsigned char *, size_t);
62 PHP_HASH_API void PHP_RIPEMD320Final(unsigned char[40], PHP_RIPEMD320_CTX *);
63 
64 #endif /* PHP_HASH_RIPEMD_H */
65