/* Userspace */
static void php_hash_do_hash(
- zval *return_value, zend_string *algo, char *data, size_t data_len, zend_bool raw_output, bool isfilename
+ zval *return_value, zend_string *algo, char *data, size_t data_len, zend_bool raw_output, bool isfilename, HashTable *args
) /* {{{ */ {
zend_string *digest;
const php_hash_ops *ops;
}
context = php_hash_alloc_context(ops);
- ops->hash_init(context);
+ ops->hash_init(context, args);
if (isfilename) {
char buf[1024];
char *data;
size_t data_len;
zend_bool raw_output = 0;
+ HashTable *args = NULL;
- ZEND_PARSE_PARAMETERS_START(2, 3)
+ ZEND_PARSE_PARAMETERS_START(2, 4)
Z_PARAM_STR(algo)
Z_PARAM_STRING(data, data_len)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(raw_output)
+ Z_PARAM_ARRAY_HT(args)
ZEND_PARSE_PARAMETERS_END();
- php_hash_do_hash(return_value, algo, data, data_len, raw_output, 0);
+ php_hash_do_hash(return_value, algo, data, data_len, raw_output, 0, args);
}
/* }}} */
char *data;
size_t data_len;
zend_bool raw_output = 0;
+ HashTable *args = NULL;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(algo)
Z_PARAM_STRING(data, data_len)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(raw_output)
+ Z_PARAM_ARRAY_HT(args)
ZEND_PARSE_PARAMETERS_END();
- php_hash_do_hash(return_value, algo, data, data_len, raw_output, 1);
+ php_hash_do_hash(return_value, algo, data, data_len, raw_output, 1, args);
}
/* }}} */
memset(K, 0, ops->block_size);
if (key_len > ops->block_size) {
/* Reduce the key first */
- ops->hash_init(context);
+ ops->hash_init(context, NULL);
ops->hash_update(context, key, key_len);
ops->hash_final(K, context);
} else {
}
static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const zend_long data_size) {
- ops->hash_init(context);
+ ops->hash_init(context, NULL);
ops->hash_update(context, key, ops->block_size);
ops->hash_update(context, data, data_size);
ops->hash_final(final, context);
if (isfilename) {
char buf[1024];
ssize_t n;
- ops->hash_init(context);
+ ops->hash_init(context, NULL);
ops->hash_update(context, K, ops->block_size);
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
ops->hash_update(context, (unsigned char *) buf, n);
void *context;
const php_hash_ops *ops;
php_hashcontext_object *hash;
+ HashTable *args = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|lS", &algo, &options, &key) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|lSh", &algo, &options, &key, &args) == FAILURE) {
RETURN_THROWS();
}
hash = php_hashcontext_from_object(Z_OBJ_P(return_value));
context = php_hash_alloc_context(ops);
- ops->hash_init(context);
+ ops->hash_init(context, args);
hash->ops = ops;
hash->context = context;
ops->hash_update(context, (unsigned char *) ZSTR_VAL(key), ZSTR_LEN(key));
ops->hash_final((unsigned char *) K, context);
/* Make the context ready to start over */
- ops->hash_init(context);
+ ops->hash_init(context, args);
} else {
memcpy(K, ZSTR_VAL(key), ZSTR_LEN(key));
}
}
/* Feed this result into the outer hash */
- hash->ops->hash_init(hash->context);
+ hash->ops->hash_init(hash->context, NULL);
hash->ops->hash_update(hash->context, hash->key, hash->ops->block_size);
hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(digest), hash->ops->digest_size);
hash->ops->hash_final((unsigned char *) ZSTR_VAL(digest), hash->context);
context = php_hash_alloc_context(ops);
// Extract
- ops->hash_init(context);
+ ops->hash_init(context, NULL);
K = emalloc(ops->block_size);
php_hash_hmac_prep_key(K, ops, context,
(unsigned char *) (salt ? ZSTR_VAL(salt) : ""), salt ? ZSTR_LEN(salt) : 0);
c[0] = (i & 0xFF);
php_hash_hmac_prep_key(K, ops, context, prk, ops->digest_size);
- ops->hash_init(context);
+ ops->hash_init(context, NULL);
ops->hash_update(context, K, ops->block_size);
if (i > 1) {
zend_bool raw_output = 0;
const php_hash_ops *ops;
void *context;
+ HashTable *args;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sssl|lb", &algo, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sssl|lbh", &algo, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output, &args) == FAILURE) {
RETURN_THROWS();
}
}
context = php_hash_alloc_context(ops);
- ops->hash_init(context);
+ ops->hash_init(context, args);
K1 = emalloc(ops->block_size);
K2 = emalloc(ops->block_size);
if (key) {
php_hash_do_hash_hmac(return_value, algo, data, data_len, key, key_len, 1, 0);
} else {
- php_hash_do_hash(return_value, algo, data, data_len, 1, 0);
+ php_hash_do_hash(return_value, algo, data, data_len, 1, 0, NULL);
}
if (algo) {
}
context = php_hash_alloc_context(ops);
- ops->hash_init(context);
+ ops->hash_init(context, NULL);
key = ecalloc(1, times * block_size);
digest = emalloc(ops->digest_size + 1);
for (i = 0; i < times; i++) {
- ops->hash_init(context);
+ ops->hash_init(context, NULL);
for (j=0;j<i;j++) {
ops->hash_update(context, &null, 1);
newobj->ops = oldobj->ops;
newobj->options = oldobj->options;
newobj->context = php_hash_alloc_context(newobj->ops);
- newobj->ops->hash_init(newobj->context);
+ newobj->ops->hash_init(newobj->context, NULL);
if (SUCCESS != newobj->ops->hash_copy(newobj->ops, oldobj->context, newobj->context)) {
efree(newobj->context);
hash->ops = ops;
hash->context = php_hash_alloc_context(ops);
- ops->hash_init(hash->context);
hash->options = options;
+ ops->hash_init(hash->context, NULL);
unserialize_result = ops->hash_unserialize(hash, magic, hash_zv);
if (unserialize_result != SUCCESS) {
/** @generate-function-entries */
-function hash(string $algo, string $data, bool $binary = false): string|false {}
+function hash(string $algo, string $data, bool $binary = false, array $options = []): string|false {}
-function hash_file(string $algo, string $filename, bool $binary = false): string|false {}
+function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {}
function hash_hmac(string $algo, string $data, string $key, bool $binary = false): string|false {}
function hash_hmac_file(string $algo, string $data, string $key, bool $binary = false): string|false {}
-function hash_init(string $algo, int $flags = 0, string $key = ""): HashContext {}
+function hash_init(string $algo, int $flags = 0, string $key = "", array $options = []): HashContext {}
function hash_update(HashContext $context, string $data): bool {}
#include "php_hash.h"
#include "php_hash_adler32.h"
-PHP_HASH_API void PHP_ADLER32Init(PHP_ADLER32_CTX *context)
+PHP_HASH_API void PHP_ADLER32Init(PHP_ADLER32_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->state = 1;
}
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 9352e0ac98e2ac53dc15d5024f9ef0c8092c4e9c */
+ * Stub hash: e8466049fca2eae179adbc19bb67e71f6486ec4e */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, key, IS_STRING, 0, "\"\"")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update, 0, 2, _IS_BOOL, 0)
#include "php_hash_crc32_tables.h"
#include "ext/standard/crc32_x86.h"
-PHP_HASH_API void PHP_CRC32Init(PHP_CRC32_CTX *context)
+PHP_HASH_API void PHP_CRC32Init(PHP_CRC32_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->state = ~0;
}
/* {{{ PHP_FNV132Init
* 32-bit FNV-1 hash initialisation
*/
-PHP_HASH_API void PHP_FNV132Init(PHP_FNV132_CTX *context)
+PHP_HASH_API void PHP_FNV132Init(PHP_FNV132_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->state = PHP_FNV1_32_INIT;
}
/* {{{ PHP_FNV164Init
* 64-bit FNV-1 hash initialisation
*/
-PHP_HASH_API void PHP_FNV164Init(PHP_FNV164_CTX *context)
+PHP_HASH_API void PHP_FNV164Init(PHP_FNV164_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->state = PHP_FNV1_64_INIT;
}
Gost(context, data);
}
-PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *context)
+PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
memset(context, 0, sizeof(*context));
context->tables = &tables_test;
}
-PHP_HASH_API void PHP_GOSTInitCrypto(PHP_GOST_CTX *context)
+PHP_HASH_API void PHP_GOSTInitCrypto(PHP_GOST_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
- PHP_GOSTInit(context);
+ PHP_GOSTInit(context, NULL);
context->tables = &tables_crypto;
}
php_hash_unserialize, \
PHP_HAVAL_SPEC, \
((b) / 8), 128, sizeof(PHP_HAVAL_CTX), 1 }; \
-PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *context) \
+PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args) \
{ int i; context->count[0] = context->count[1] = 0; \
for(i = 0; i < 8; i++) context->state[i] = D0[i]; \
context->passes = p; context->output = b; \
0
};
-PHP_HASH_API void PHP_JOAATInit(PHP_JOAAT_CTX *context)
+PHP_HASH_API void PHP_JOAATInit(PHP_JOAAT_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->state = 0;
}
const php_hash_ops php_hash_md5_ops = {
"md5",
- (php_hash_init_func_t) PHP_MD5Init,
+ (php_hash_init_func_t) PHP_MD5InitArgs,
(php_hash_update_func_t) PHP_MD5Update,
(php_hash_final_func_t) PHP_MD5Final,
php_hash_copy,
const php_hash_ops php_hash_md4_ops = {
"md4",
- (php_hash_init_func_t) PHP_MD4Init,
+ (php_hash_init_func_t) PHP_MD4InitArgs,
(php_hash_update_func_t) PHP_MD4Update,
(php_hash_final_func_t) PHP_MD4Final,
php_hash_copy,
const php_hash_ops php_hash_md2_ops = {
"md2",
- (php_hash_init_func_t) PHP_MD2Init,
+ (php_hash_init_func_t) PHP_MD2InitArgs,
(php_hash_update_func_t) PHP_MD2Update,
(php_hash_final_func_t) PHP_MD2Final,
php_hash_copy,
state[3] += d;
}
-/* {{{ PHP_MD4Init
+/* {{{ PHP_MD4InitArgs
* MD4 initialization. Begins an MD4 operation, writing a new context.
*/
-PHP_HASH_API void PHP_MD4Init(PHP_MD4_CTX * context)
+PHP_HASH_API void PHP_MD4InitArgs(PHP_MD4_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10,
49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 };
-PHP_HASH_API void PHP_MD2Init(PHP_MD2_CTX *context)
+PHP_HASH_API void PHP_MD2InitArgs(PHP_MD2_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
memset(context, 0, sizeof(PHP_MD2_CTX));
}
0
};
-PHP_HASH_API void PHP_MURMUR3AInit(PHP_MURMUR3A_CTX *ctx)
+PHP_HASH_API void PHP_MURMUR3AInit(PHP_MURMUR3A_CTX *ctx, HashTable *args)
{
- ctx->h = 0;
+ if (args) {
+ zval *seed = zend_hash_str_find_deref(args, "seed", sizeof("seed") - 1);
+ /* This might be a bit too restrictive, but thinking that a seed might be set
+ once and for all, it should be done a clean way. */
+ if (seed && IS_LONG == Z_TYPE_P(seed)) {
+ ctx->h = (uint32_t)Z_LVAL_P(seed);
+ } else {
+ ctx->h = 0;
+ }
+ } else {
+ ctx->h = 0;
+ }
ctx->carry = 0;
ctx->len = 0;
}
0
};
-PHP_HASH_API void PHP_MURMUR3CInit(PHP_MURMUR3C_CTX *ctx)
+PHP_HASH_API void PHP_MURMUR3CInit(PHP_MURMUR3C_CTX *ctx, HashTable *args)
{
- memset(&ctx->h, 0, sizeof ctx->h);
+ if (args) {
+ zval *seed = zend_hash_str_find_deref(args, "seed", sizeof("seed") - 1);
+ /* This might be a bit too restrictive, but thinking that a seed might be set
+ once and for all, it should be done a clean way. */
+ if (seed && IS_LONG == Z_TYPE_P(seed)) {
+ uint32_t _seed = (uint32_t)Z_LVAL_P(seed);
+ ctx->h[0] = _seed;
+ ctx->h[1] = _seed;
+ ctx->h[2] = _seed;
+ ctx->h[3] = _seed;
+ } else {
+ memset(&ctx->h, 0, sizeof ctx->h);
+ }
+ } else {
+ memset(&ctx->h, 0, sizeof ctx->h);
+ }
memset(&ctx->carry, 0, sizeof ctx->carry);
ctx->len = 0;
}
0
};
-PHP_HASH_API void PHP_MURMUR3FInit(PHP_MURMUR3F_CTX *ctx)
+PHP_HASH_API void PHP_MURMUR3FInit(PHP_MURMUR3F_CTX *ctx, HashTable *args)
{
- memset(&ctx->h, 0, sizeof ctx->h);
+ if (args) {
+ zval *seed = zend_hash_str_find_deref(args, "seed", sizeof("seed") - 1);
+ /* This might be a bit too restrictive, but thinking that a seed might be set
+ once and for all, it should be done a clean way. */
+ if (seed && IS_LONG == Z_TYPE_P(seed)) {
+ uint64_t _seed = (uint64_t)Z_LVAL_P(seed);
+ ctx->h[0] = _seed;
+ ctx->h[1] = _seed;
+ } else {
+ memset(&ctx->h, 0, sizeof ctx->h);
+ }
+ } else {
+ memset(&ctx->h, 0, sizeof ctx->h);
+ }
memset(&ctx->carry, 0, sizeof ctx->carry);
ctx->len = 0;
}
/* {{{ PHP_RIPEMD128Init
* ripemd128 initialization. Begins a ripemd128 operation, writing a new context.
*/
-PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX * context)
+PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
/* {{{ PHP_RIPEMD256Init
* ripemd256 initialization. Begins a ripemd256 operation, writing a new context.
*/
-PHP_HASH_API void PHP_RIPEMD256Init(PHP_RIPEMD256_CTX * context)
+PHP_HASH_API void PHP_RIPEMD256Init(PHP_RIPEMD256_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
/* {{{ PHP_RIPEMD160Init
* ripemd160 initialization. Begins a ripemd160 operation, writing a new context.
*/
-PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX * context)
+PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
/* {{{ PHP_RIPEMD320Init
* ripemd320 initialization. Begins a ripemd320 operation, writing a new context.
*/
-PHP_HASH_API void PHP_RIPEMD320Init(PHP_RIPEMD320_CTX * context)
+PHP_HASH_API void PHP_RIPEMD320Init(PHP_RIPEMD320_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
const php_hash_ops php_hash_sha1_ops = {
"sha1",
- (php_hash_init_func_t) PHP_SHA1Init,
+ (php_hash_init_func_t) PHP_SHA1InitArgs,
(php_hash_update_func_t) PHP_SHA1Update,
(php_hash_final_func_t) PHP_SHA1Final,
php_hash_copy,
const php_hash_ops php_hash_sha256_ops = {
"sha256",
- (php_hash_init_func_t) PHP_SHA256Init,
+ (php_hash_init_func_t) PHP_SHA256InitArgs,
(php_hash_update_func_t) PHP_SHA256Update,
(php_hash_final_func_t) PHP_SHA256Final,
php_hash_copy,
const php_hash_ops php_hash_sha224_ops = {
"sha224",
- (php_hash_init_func_t) PHP_SHA224Init,
+ (php_hash_init_func_t) PHP_SHA224InitArgs,
(php_hash_update_func_t) PHP_SHA224Update,
(php_hash_final_func_t) PHP_SHA224Final,
php_hash_copy,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 };
-/* {{{ PHP_SHA256Init
+/* {{{ PHP_SHA256InitArgs
* SHA256 initialization. Begins an SHA256 operation, writing a new context.
*/
-PHP_HASH_API void PHP_SHA256Init(PHP_SHA256_CTX * context)
+PHP_HASH_API void PHP_SHA256InitArgs(PHP_SHA256_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
}
/* }}} */
-/* {{{ PHP_SHA224Init
+/* {{{ PHP_SHA224InitArgs
* SHA224 initialization. Begins an SHA224 operation, writing a new context.
*/
-PHP_HASH_API void PHP_SHA224Init(PHP_SHA224_CTX * context)
+PHP_HASH_API void PHP_SHA224InitArgs(PHP_SHA224_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
}
/* }}} */
-/* {{{ PHP_SHA384Init
+/* {{{ PHP_SHA384InitArgs
* SHA384 initialization. Begins an SHA384 operation, writing a new context.
*/
-PHP_HASH_API void PHP_SHA384Init(PHP_SHA384_CTX * context)
+PHP_HASH_API void PHP_SHA384InitArgs(PHP_SHA384_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
const php_hash_ops php_hash_sha384_ops = {
"sha384",
- (php_hash_init_func_t) PHP_SHA384Init,
+ (php_hash_init_func_t) PHP_SHA384InitArgs,
(php_hash_update_func_t) PHP_SHA384Update,
(php_hash_final_func_t) PHP_SHA384Final,
php_hash_copy,
1
};
-/* {{{ PHP_SHA512Init
+/* {{{ PHP_SHA512InitArgs
* SHA512 initialization. Begins an SHA512 operation, writing a new context.
*/
-PHP_HASH_API void PHP_SHA512Init(PHP_SHA512_CTX * context)
+PHP_HASH_API void PHP_SHA512InitArgs(PHP_SHA512_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
}
/* }}} */
-/* {{{ PHP_SHA512_256Init
+/* {{{ PHP_SHA512_256InitArgs
* SHA512/245 initialization. Identical algorithm to SHA512, using alternate initval and truncation
*/
-PHP_HASH_API void PHP_SHA512_256Init(PHP_SHA512_CTX * context)
+PHP_HASH_API void PHP_SHA512_256InitArgs(PHP_SHA512_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
}
/* }}} */
-/* {{{ PHP_SHA512_224Init
+/* {{{ PHP_SHA512_224InitArgs
* SHA512/224 initialization. Identical algorithm to SHA512, using alternate initval and truncation
*/
-PHP_HASH_API void PHP_SHA512_224Init(PHP_SHA512_CTX * context)
+PHP_HASH_API void PHP_SHA512_224InitArgs(PHP_SHA512_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
const php_hash_ops php_hash_sha512_ops = {
"sha512",
- (php_hash_init_func_t) PHP_SHA512Init,
+ (php_hash_init_func_t) PHP_SHA512InitArgs,
(php_hash_update_func_t) PHP_SHA512Update,
(php_hash_final_func_t) PHP_SHA512Final,
php_hash_copy,
const php_hash_ops php_hash_sha512_256_ops = {
"sha512/256",
- (php_hash_init_func_t) PHP_SHA512_256Init,
+ (php_hash_init_func_t) PHP_SHA512_256InitArgs,
(php_hash_update_func_t) PHP_SHA512_256Update,
(php_hash_final_func_t) PHP_SHA512_256Final,
php_hash_copy,
const php_hash_ops php_hash_sha512_224_ops = {
"sha512/224",
- (php_hash_init_func_t) PHP_SHA512_224Init,
+ (php_hash_init_func_t) PHP_SHA512_224InitArgs,
(php_hash_update_func_t) PHP_SHA512_224Update,
(php_hash_final_func_t) PHP_SHA512_224Final,
php_hash_copy,
// ==========================================================================
#define DECLARE_SHA3_OPS(bits) \
-void PHP_SHA3##bits##Init(PHP_SHA3_##bits##_CTX* ctx) { \
+void PHP_SHA3##bits##Init(PHP_SHA3_##bits##_CTX* ctx, ZEND_ATTRIBUTE_UNUSED HashTable *args) { \
PHP_SHA3_Init(ctx, bits); \
} \
void PHP_SHA3##bits##Update(PHP_SHA3_##bits##_CTX* ctx, \
// ==========================================================================
#define DECLARE_SHA3_OPS(bits) \
-void PHP_SHA3##bits##Init(PHP_SHA3_##bits##_CTX* ctx) { \
+void PHP_SHA3##bits##Init(PHP_SHA3_##bits##_CTX* ctx, ZEND_ATTRIBUTE_UNUSED HashTable *args) { \
ZEND_ASSERT(sizeof(Keccak_HashInstance) <= sizeof(PHP_SHA3_##bits##_CTX)); \
Keccak_HashInitialize_SHA3_##bits((Keccak_HashInstance *)ctx); \
} \
ZEND_SECURE_ZERO(&context->state[8], sizeof(uint32_t) * 8);
}
-PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *context)
+PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
memset(context, 0, sizeof(*context));
}
}
}
-PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context)
+PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
memset(context, 0, sizeof(*context));
context->state[0] = L64(0x0123456789ABCDEF);
context->state[2] = L64(0xF096A5B4C3B2E187);
}
-PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context)
+PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
memset(context, 0, sizeof(*context));
context->passes = 1;
ZEND_SECURE_ZERO(state, sizeof(state));
}
-PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *context)
+PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
memset(context, 0, sizeof(*context));
}
typedef struct _php_hashcontext_object php_hashcontext_object;
-typedef void (*php_hash_init_func_t)(void *context);
+typedef void (*php_hash_init_func_t)(void *context, HashTable *args);
typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, size_t count);
typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context);
typedef int (*php_hash_copy_func_t)(const void *ops, void *orig_context, void *dest_context);
} PHP_ADLER32_CTX;
#define PHP_ADLER32_SPEC "l."
-PHP_HASH_API void PHP_ADLER32Init(PHP_ADLER32_CTX *context);
+PHP_HASH_API void PHP_ADLER32Init(PHP_ADLER32_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_ADLER32Update(PHP_ADLER32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_ADLER32Final(unsigned char digest[4], PHP_ADLER32_CTX *context);
PHP_HASH_API int PHP_ADLER32Copy(const php_hash_ops *ops, PHP_ADLER32_CTX *orig_context, PHP_ADLER32_CTX *copy_context);
} PHP_CRC32_CTX;
#define PHP_CRC32_SPEC "l."
-PHP_HASH_API void PHP_CRC32Init(PHP_CRC32_CTX *context);
+PHP_HASH_API void PHP_CRC32Init(PHP_CRC32_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_CRC32Update(PHP_CRC32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_CRC32BUpdate(PHP_CRC32_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_CRC32CUpdate(PHP_CRC32_CTX *context, const unsigned char *input, size_t len);
#define PHP_FNV164_SPEC "q."
-PHP_HASH_API void PHP_FNV132Init(PHP_FNV132_CTX *context);
+PHP_HASH_API void PHP_FNV132Init(PHP_FNV132_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_FNV132Update(PHP_FNV132_CTX *context, const unsigned char *input, size_t inputLen);
PHP_HASH_API void PHP_FNV1a32Update(PHP_FNV132_CTX *context, const unsigned char *input, size_t inputLen);
PHP_HASH_API void PHP_FNV132Final(unsigned char digest[16], PHP_FNV132_CTX * context);
-PHP_HASH_API void PHP_FNV164Init(PHP_FNV164_CTX *context);
+PHP_HASH_API void PHP_FNV164Init(PHP_FNV164_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_FNV164Update(PHP_FNV164_CTX *context, const unsigned char *input, size_t inputLen);
PHP_HASH_API void PHP_FNV1a64Update(PHP_FNV164_CTX *context, const unsigned char *input, size_t inputLen);
PHP_HASH_API void PHP_FNV164Final(unsigned char digest[16], PHP_FNV164_CTX * context);
} PHP_GOST_CTX;
#define PHP_GOST_SPEC "l16l2bb32"
-PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *);
+PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_GOSTFinal(unsigned char[64], PHP_GOST_CTX *);
} PHP_HAVAL_CTX;
#define PHP_HAVAL_SPEC "l8l2b128"
-#define PHP_HASH_HAVAL_INIT_DECL(p,b) PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *); \
+#define PHP_HASH_HAVAL_INIT_DECL(p,b) PHP_HASH_API void PHP_##p##HAVAL##b##Init(PHP_HAVAL_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); \
PHP_HASH_API void PHP_HAVAL##b##Final(unsigned char*, PHP_HAVAL_CTX *);
PHP_HASH_API void PHP_HAVALUpdate(PHP_HAVAL_CTX *, const unsigned char *, size_t);
} PHP_JOAAT_CTX;
#define PHP_JOAAT_SPEC "l."
-PHP_HASH_API void PHP_JOAATInit(PHP_JOAAT_CTX *context);
+PHP_HASH_API void PHP_JOAATInit(PHP_JOAAT_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_JOAATUpdate(PHP_JOAAT_CTX *context, const unsigned char *input, size_t inputLen);
PHP_HASH_API void PHP_JOAATFinal(unsigned char digest[16], PHP_JOAAT_CTX * context);
} PHP_MD4_CTX;
#define PHP_MD4_SPEC "l4l2b64."
-PHP_HASH_API void PHP_MD4Init(PHP_MD4_CTX *);
+#define PHP_MD4Init(ctx) PHP_MD4InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_MD4InitArgs(PHP_MD4_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_MD4Update(PHP_MD4_CTX *context, const unsigned char *, size_t);
PHP_HASH_API void PHP_MD4Final(unsigned char[16], PHP_MD4_CTX *);
} PHP_MD2_CTX;
#define PHP_MD2_SPEC "b48b16b16b."
-PHP_HASH_API void PHP_MD2Init(PHP_MD2_CTX *context);
+#define PHP_MD2Init(ctx) PHP_MD2InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_MD2InitArgs(PHP_MD2_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_MD2Update(PHP_MD2_CTX *context, const unsigned char *, size_t);
PHP_HASH_API void PHP_MD2Final(unsigned char[16], PHP_MD2_CTX *);
} PHP_MURMUR3A_CTX;
#define PHP_MURMUR3A_SPEC "lll"
-PHP_HASH_API void PHP_MURMUR3AInit(PHP_MURMUR3A_CTX *ctx);
+PHP_HASH_API void PHP_MURMUR3AInit(PHP_MURMUR3A_CTX *ctx, HashTable *args);
PHP_HASH_API void PHP_MURMUR3AUpdate(PHP_MURMUR3A_CTX *ctx, const unsigned char *in, size_t len);
PHP_HASH_API void PHP_MURMUR3AFinal(unsigned char digest[4], PHP_MURMUR3A_CTX *ctx);
PHP_HASH_API int PHP_MURMUR3ACopy(const php_hash_ops *ops, PHP_MURMUR3A_CTX *orig_context, PHP_MURMUR3A_CTX *copy_context);
} PHP_MURMUR3C_CTX;
#define PHP_MURMUR3C_SPEC "lllllllll"
-PHP_HASH_API void PHP_MURMUR3CInit(PHP_MURMUR3C_CTX *ctx);
+PHP_HASH_API void PHP_MURMUR3CInit(PHP_MURMUR3C_CTX *ctx, HashTable *args);
PHP_HASH_API void PHP_MURMUR3CUpdate(PHP_MURMUR3C_CTX *ctx, const unsigned char *in, size_t len);
PHP_HASH_API void PHP_MURMUR3CFinal(unsigned char digest[16], PHP_MURMUR3C_CTX *ctx);
PHP_HASH_API int PHP_MURMUR3CCopy(const php_hash_ops *ops, PHP_MURMUR3C_CTX *orig_context, PHP_MURMUR3C_CTX *copy_context);
} PHP_MURMUR3F_CTX;
#define PHP_MURMUR3F_SPEC "qqqql"
-PHP_HASH_API void PHP_MURMUR3FInit(PHP_MURMUR3F_CTX *ctx);
+PHP_HASH_API void PHP_MURMUR3FInit(PHP_MURMUR3F_CTX *ctx, HashTable *args);
PHP_HASH_API void PHP_MURMUR3FUpdate(PHP_MURMUR3F_CTX *ctx, const unsigned char *in, size_t len);
PHP_HASH_API void PHP_MURMUR3FFinal(unsigned char digest[16], PHP_MURMUR3F_CTX *ctx);
PHP_HASH_API int PHP_MURMUR3FCopy(const php_hash_ops *ops, PHP_MURMUR3F_CTX *orig_context, PHP_MURMUR3F_CTX *copy_context);
} PHP_RIPEMD320_CTX;
#define PHP_RIPEMD320_SPEC "l10l2b64."
-PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX *);
+PHP_HASH_API void PHP_RIPEMD128Init(PHP_RIPEMD128_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_RIPEMD128Update(PHP_RIPEMD128_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_RIPEMD128Final(unsigned char[16], PHP_RIPEMD128_CTX *);
-PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX *);
+PHP_HASH_API void PHP_RIPEMD160Init(PHP_RIPEMD160_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_RIPEMD160Update(PHP_RIPEMD160_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_RIPEMD160Final(unsigned char[20], PHP_RIPEMD160_CTX *);
-PHP_HASH_API void PHP_RIPEMD256Init(PHP_RIPEMD256_CTX *);
+PHP_HASH_API void PHP_RIPEMD256Init(PHP_RIPEMD256_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_RIPEMD256Update(PHP_RIPEMD256_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_RIPEMD256Final(unsigned char[32], PHP_RIPEMD256_CTX *);
-PHP_HASH_API void PHP_RIPEMD320Init(PHP_RIPEMD320_CTX *);
+PHP_HASH_API void PHP_RIPEMD320Init(PHP_RIPEMD320_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_RIPEMD320Update(PHP_RIPEMD320_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_RIPEMD320Final(unsigned char[40], PHP_RIPEMD320_CTX *);
} PHP_SHA224_CTX;
#define PHP_SHA224_SPEC "l8l2b64."
-PHP_HASH_API void PHP_SHA224Init(PHP_SHA224_CTX *);
+#define PHP_SHA224Init(ctx) PHP_SHA224InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_SHA224InitArgs(PHP_SHA224_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA224Update(PHP_SHA224_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SHA224Final(unsigned char[28], PHP_SHA224_CTX *);
} PHP_SHA256_CTX;
#define PHP_SHA256_SPEC "l8l2b64."
-PHP_HASH_API void PHP_SHA256Init(PHP_SHA256_CTX *);
+#define PHP_SHA256Init(ctx) PHP_SHA256InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_SHA256InitArgs(PHP_SHA256_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SHA256Final(unsigned char[32], PHP_SHA256_CTX *);
} PHP_SHA384_CTX;
#define PHP_SHA384_SPEC "q8q2b128."
-PHP_HASH_API void PHP_SHA384Init(PHP_SHA384_CTX *);
+#define PHP_SHA384Init(ctx) PHP_SHA384InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_SHA384InitArgs(PHP_SHA384_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA384Update(PHP_SHA384_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SHA384Final(unsigned char[48], PHP_SHA384_CTX *);
} PHP_SHA512_CTX;
#define PHP_SHA512_SPEC "q8q2b128."
-PHP_HASH_API void PHP_SHA512Init(PHP_SHA512_CTX *);
+#define PHP_SHA512Init(ctx) PHP_SHA512InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_SHA512InitArgs(PHP_SHA512_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA512Update(PHP_SHA512_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SHA512Final(unsigned char[64], PHP_SHA512_CTX *);
-PHP_HASH_API void PHP_SHA512_256Init(PHP_SHA512_CTX *);
+#define PHP_SHA512_256Init(ctx) PHP_SHA512_256InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_SHA512_256InitArgs(PHP_SHA512_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
#define PHP_SHA512_256Update PHP_SHA512Update
PHP_HASH_API void PHP_SHA512_256Final(unsigned char[32], PHP_SHA512_CTX *);
-PHP_HASH_API void PHP_SHA512_224Init(PHP_SHA512_CTX *);
+#define PHP_SHA512_224Init(ctx) PHP_SHA512_224InitArgs(ctx, NULL)
+PHP_HASH_API void PHP_SHA512_224InitArgs(PHP_SHA512_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
#define PHP_SHA512_224Update PHP_SHA512Update
PHP_HASH_API void PHP_SHA512_224Final(unsigned char[28], PHP_SHA512_CTX *);
typedef PHP_SHA3_CTX PHP_SHA3_384_CTX;
typedef PHP_SHA3_CTX PHP_SHA3_512_CTX;
-PHP_HASH_API void PHP_SHA3224Init(PHP_SHA3_224_CTX*);
+PHP_HASH_API void PHP_SHA3224Init(PHP_SHA3_224_CTX*, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA3224Update(PHP_SHA3_224_CTX*, const unsigned char*, size_t);
PHP_HASH_API void PHP_SAH3224Final(unsigned char[32], PHP_SHA3_224_CTX*);
-PHP_HASH_API void PHP_SHA3256Init(PHP_SHA3_256_CTX*);
+PHP_HASH_API void PHP_SHA3256Init(PHP_SHA3_256_CTX*, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA3256Update(PHP_SHA3_256_CTX*, const unsigned char*, size_t);
PHP_HASH_API void PHP_SAH3256Final(unsigned char[32], PHP_SHA3_256_CTX*);
-PHP_HASH_API void PHP_SHA3384Init(PHP_SHA3_384_CTX*);
+PHP_HASH_API void PHP_SHA3384Init(PHP_SHA3_384_CTX*, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA3384Update(PHP_SHA3_384_CTX*, const unsigned char*, size_t);
PHP_HASH_API void PHP_SAH3384Final(unsigned char[32], PHP_SHA3_384_CTX*);
-PHP_HASH_API void PHP_SHA3512Init(PHP_SHA3_512_CTX*);
+PHP_HASH_API void PHP_SHA3512Init(PHP_SHA3_512_CTX*, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SHA3512Update(PHP_SHA3_512_CTX*, const unsigned char*, size_t);
PHP_HASH_API void PHP_SAH3512Final(unsigned char[32], PHP_SHA3_512_CTX*);
} PHP_SNEFRU_CTX;
#define PHP_SNEFRU_SPEC "l16l2bb32"
-PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *);
+PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_SNEFRUUpdate(PHP_SNEFRU_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_SNEFRUFinal(unsigned char[32], PHP_SNEFRU_CTX *);
} PHP_TIGER_CTX;
#define PHP_TIGER_SPEC "q3qb64l"
-PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context);
-PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context);
+PHP_HASH_API void PHP_3TIGERInit(PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
+PHP_HASH_API void PHP_4TIGERInit(PHP_TIGER_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *input, size_t len);
PHP_HASH_API void PHP_TIGER128Final(unsigned char digest[16], PHP_TIGER_CTX *context);
PHP_HASH_API void PHP_TIGER160Final(unsigned char digest[20], PHP_TIGER_CTX *context);
} PHP_WHIRLPOOL_CTX;
#define PHP_WHIRLPOOL_SPEC "q8b32iib64."
-PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *);
+PHP_HASH_API void PHP_WHIRLPOOLInit(PHP_WHIRLPOOL_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHP_HASH_API void PHP_WHIRLPOOLUpdate(PHP_WHIRLPOOL_CTX *, const unsigned char *, size_t);
PHP_HASH_API void PHP_WHIRLPOOLFinal(unsigned char[64], PHP_WHIRLPOOL_CTX *);
--- /dev/null
+--TEST--
+Hash: MurmurHash3 seed
+--FILE--
+<?php
+
+$ctx = hash_init("murmur3f", options: ["seed" => 42]);
+hash_update($ctx, "Two");
+hash_update($ctx, " hashes");
+hash_update($ctx, " meet");
+hash_update($ctx, " in");
+hash_update($ctx, " a");
+hash_update($ctx, " bar.");
+$h0 = hash_final($ctx);
+echo $h0, "\n";
+
+$h0 = hash("murmur3f", "Two hashes meet in a bar.", options: ["seed" => 42]);
+echo $h0, "\n";
+
+$ctx = hash_init("murmur3c", options: ["seed" => 106]);
+hash_update($ctx, "Two");
+hash_update($ctx, " hashes");
+hash_update($ctx, " meet");
+hash_update($ctx, " in");
+hash_update($ctx, " a");
+hash_update($ctx, " bar.");
+$h0 = hash_final($ctx);
+echo $h0, "\n";
+
+$h0 = hash("murmur3c", "Two hashes meet in a bar.", options: ["seed" => 106]);
+echo $h0, "\n";
+
+$ctx = hash_init("murmur3a", options: ["seed" => 2345]);
+hash_update($ctx, "Two");
+hash_update($ctx, " hashes");
+hash_update($ctx, " meet");
+hash_update($ctx, " in");
+hash_update($ctx, " a");
+hash_update($ctx, " bar.");
+$h0 = hash_final($ctx);
+echo $h0, "\n";
+
+$h0 = hash("murmur3a", "Two hashes meet in a bar.", options: ["seed" => 2345]);
+echo $h0, "\n";
+
+?>
+--EXPECT--
+95855f9be0db784a5c37e878c4a4dcee
+95855f9be0db784a5c37e878c4a4dcee
+f64c9eb40287fa686575163893e283b2
+f64c9eb40287fa686575163893e283b2
+7f7ec59b
+7f7ec59b
return ptr;
}
-PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx)
+PHPAPI void PHP_MD5InitArgs(PHP_MD5_CTX *ctx, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
ctx->a = 0x67452301;
ctx->b = 0xefcdab89;
} PHP_MD5_CTX;
#define PHP_MD5_SPEC "llllllb64l16."
-PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx);
+#define PHP_MD5Init(ctx) PHP_MD5InitArgs(ctx, NULL)
+PHPAPI void PHP_MD5InitArgs(PHP_MD5_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size);
PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx);
/* {{{ PHP_SHA1Init
* SHA1 initialization. Begins an SHA1 operation, writing a new context.
*/
-PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context)
+PHPAPI void PHP_SHA1InitArgs(PHP_SHA1_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args)
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
} PHP_SHA1_CTX;
#define PHP_SHA1_SPEC "l5l2b64."
-PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *);
+#define PHP_SHA1Init(ctx) PHP_SHA1InitArgs(ctx, NULL)
+PHPAPI void PHP_SHA1InitArgs(PHP_SHA1_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *);
PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, size_t);
PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
PHPAPI void make_sha1_digest(char *sha1str, const unsigned char *digest);