Lines Matching refs:hash
180 PHP_FUNCTION(hash) in PHP_FUNCTION() argument
336 php_hash_data *hash; in PHP_FUNCTION() local
358 hash = emalloc(sizeof(php_hash_data)); in PHP_FUNCTION()
359 hash->ops = ops; in PHP_FUNCTION()
360 hash->context = context; in PHP_FUNCTION()
361 hash->options = options; in PHP_FUNCTION()
362 hash->key = NULL; in PHP_FUNCTION()
385 hash->key = (unsigned char *) K; in PHP_FUNCTION()
388 RETURN_RES(zend_register_resource(hash, php_hash_le_hash)); in PHP_FUNCTION()
397 php_hash_data *hash; in PHP_FUNCTION() local
405 …if ((hash = (php_hash_data *)zend_fetch_resource(Z_RES_P(zhash), PHP_HASH_RESNAME, php_hash_le_has… in PHP_FUNCTION()
409 hash->ops->hash_update(hash->context, (unsigned char *) data, data_len); in PHP_FUNCTION()
420 php_hash_data *hash; in PHP_FUNCTION() local
428 …if ((hash = (php_hash_data *)zend_fetch_resource(Z_RES_P(zhash), PHP_HASH_RESNAME, php_hash_le_has… in PHP_FUNCTION()
446 hash->ops->hash_update(hash->context, (unsigned char *) buf, n); in PHP_FUNCTION()
460 php_hash_data *hash; in PHP_FUNCTION() local
470 …if ((hash = (php_hash_data *)zend_fetch_resource(Z_RES_P(zhash), PHP_HASH_RESNAME, php_hash_le_has… in PHP_FUNCTION()
482 hash->ops->hash_update(hash->context, (unsigned char *) buf, n); in PHP_FUNCTION()
495 php_hash_data *hash; in PHP_FUNCTION() local
504 …if ((hash = (php_hash_data *)zend_fetch_resource(Z_RES_P(zhash), PHP_HASH_RESNAME, php_hash_le_has… in PHP_FUNCTION()
508 digest_len = hash->ops->digest_size; in PHP_FUNCTION()
510 hash->ops->hash_final((unsigned char *) ZSTR_VAL(digest), hash->context); in PHP_FUNCTION()
511 if (hash->options & PHP_HASH_HMAC) { in PHP_FUNCTION()
515 for(i=0; i < hash->ops->block_size; i++) { in PHP_FUNCTION()
516 hash->key[i] ^= 0x6A; in PHP_FUNCTION()
520 hash->ops->hash_init(hash->context); in PHP_FUNCTION()
521 hash->ops->hash_update(hash->context, hash->key, hash->ops->block_size); in PHP_FUNCTION()
522 hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(digest), hash->ops->digest_size); in PHP_FUNCTION()
523 hash->ops->hash_final((unsigned char *) ZSTR_VAL(digest), hash->context); in PHP_FUNCTION()
526 ZEND_SECURE_ZERO(hash->key, hash->ops->block_size); in PHP_FUNCTION()
527 efree(hash->key); in PHP_FUNCTION()
528 hash->key = NULL; in PHP_FUNCTION()
531 efree(hash->context); in PHP_FUNCTION()
532 hash->context = NULL; in PHP_FUNCTION()
553 php_hash_data *hash, *copy_hash; in PHP_FUNCTION() local
561 …if ((hash = (php_hash_data *)zend_fetch_resource(Z_RES_P(zhash), PHP_HASH_RESNAME, php_hash_le_has… in PHP_FUNCTION()
566 context = emalloc(hash->ops->context_size); in PHP_FUNCTION()
567 hash->ops->hash_init(context); in PHP_FUNCTION()
569 res = hash->ops->hash_copy(hash->ops, hash->context, context); in PHP_FUNCTION()
576 copy_hash->ops = hash->ops; in PHP_FUNCTION()
578 copy_hash->options = hash->options; in PHP_FUNCTION()
579 copy_hash->key = ecalloc(1, hash->ops->block_size); in PHP_FUNCTION()
580 if (hash->key) { in PHP_FUNCTION()
581 memcpy(copy_hash->key, hash->key, hash->ops->block_size); in PHP_FUNCTION()
886 php_hash_data *hash = (php_hash_data*)rsrc->ptr; in php_hash_dtor() local
889 if (hash->context) { in php_hash_dtor()
890 unsigned char *dummy = emalloc(hash->ops->digest_size); in php_hash_dtor()
891 hash->ops->hash_final(dummy, hash->context); in php_hash_dtor()
893 efree(hash->context); in php_hash_dtor()
896 if (hash->key) { in php_hash_dtor()
897 ZEND_SECURE_ZERO(hash->key, hash->ops->block_size); in php_hash_dtor()
898 efree(hash->key); in php_hash_dtor()
900 efree(hash); in php_hash_dtor()
1114 PHP_MINIT_FUNCTION(hash) in PHP_MINIT_FUNCTION() argument
1188 PHP_MSHUTDOWN_FUNCTION(hash) in PHP_MSHUTDOWN_FUNCTION() argument
1198 PHP_MINFO_FUNCTION(hash) in PHP_MINFO_FUNCTION() argument
1335 ZEND_ARG_INFO(0, hash)
1339 ZEND_ARG_INFO(0, hash)
1343 ZEND_ARG_INFO(0, hash)
1353 ZEND_ARG_INFO(0, hash)
1364 PHP_FE(hash, arginfo_hash)
1411 PHP_MINIT(hash),
1412 PHP_MSHUTDOWN(hash),
1415 PHP_MINFO(hash),
1422 ZEND_GET_MODULE(hash)