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