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_RIPEMD_H 18 #define PHP_HASH_RIPEMD_H 19 #include "ext/standard/basic_functions.h" 20 21 /* RIPEMD context. */ 22 typedef struct { 23 uint32_t state[4]; /* state (ABCD) */ 24 uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ 25 unsigned char buffer[64]; /* input buffer */ 26 } PHP_RIPEMD128_CTX; 27 #define PHP_RIPEMD128_SPEC "l4l2b64." 28 29 typedef struct { 30 uint32_t state[5]; /* state (ABCD) */ 31 uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ 32 unsigned char buffer[64]; /* input buffer */ 33 } PHP_RIPEMD160_CTX; 34 #define PHP_RIPEMD160_SPEC "l5l2b64." 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 #define PHP_RIPEMD256_SPEC "l8l2b64." 42 43 typedef struct { 44 uint32_t state[10]; /* state (ABCD) */ 45 uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ 46 unsigned char buffer[64]; /* input buffer */ 47 } PHP_RIPEMD320_CTX; 48 #define PHP_RIPEMD320_SPEC "l10l2b64." 49 50 PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); 51 PHP_HASH_API void PHP_RIPEMD128Update(PHP_RIPEMD128_CTX *, const unsigned char *, size_t); 52 PHP_HASH_API void PHP_RIPEMD128Final(unsigned char[16], PHP_RIPEMD128_CTX *); 53 54 PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); 55 PHP_HASH_API void PHP_RIPEMD160Update(PHP_RIPEMD160_CTX *, const unsigned char *, size_t); 56 PHP_HASH_API void PHP_RIPEMD160Final(unsigned char[20], PHP_RIPEMD160_CTX *); 57 58 PHP_HASH_API void PHP_RIPEMD256Init(PHP_RIPEMD256_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); 59 PHP_HASH_API void PHP_RIPEMD256Update(PHP_RIPEMD256_CTX *, const unsigned char *, size_t); 60 PHP_HASH_API void PHP_RIPEMD256Final(unsigned char[32], PHP_RIPEMD256_CTX *); 61 62 PHP_HASH_API void PHP_RIPEMD320Init(PHP_RIPEMD320_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); 63 PHP_HASH_API void PHP_RIPEMD320Update(PHP_RIPEMD320_CTX *, const unsigned char *, size_t); 64 PHP_HASH_API void PHP_RIPEMD320Final(unsigned char[40], PHP_RIPEMD320_CTX *); 65 66 #endif /* PHP_HASH_RIPEMD_H */ 67