}
/* }}} */
+/* {{{ proto array hash_hmac_algos(void)
+Return a list of registered hashing algorithms suitable for hash_hmac() */
+PHP_FUNCTION(hash_hmac_algos)
+{
+ zend_string *str;
+ const php_hash_ops *ops;
+
+ array_init(return_value);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&php_hash_hashtable, str, ops) {
+ if (ops->is_crypto) {
+ add_next_index_str(return_value, zend_string_copy(str));
+ }
+ } ZEND_HASH_FOREACH_END();
+}
+/* }}} */
+
/* {{{ proto string hash_hkdf(string algo, string ikm [, int length = 0, string info = '', string salt = ''])
RFC5869 HMAC-based key derivation function */
PHP_FUNCTION(hash_hkdf)
PHP_FE(hash_copy, arginfo_hash_copy)
PHP_FE(hash_algos, arginfo_hash_algos)
+ PHP_FE(hash_hmac_algos, arginfo_hash_algos)
PHP_FE(hash_pbkdf2, arginfo_hash_pbkdf2)
PHP_FE(hash_equals, arginfo_hash_equals)
PHP_FE(hash_hkdf, arginfo_hash_hkdf)
--- /dev/null
+--TEST--
+Test hash_hmac_algos() function : basic functionality
+--SKIPIF--
+<?php extension_loaded('hash') or die('skip: hash extension not loaded.'); ?>
+--FILE--
+<?php
+
+print_r(hash_hmac_algos());
+
+--EXPECTF--
+Array
+(
+ [%d] => md2
+ [%d] => md4
+ [%d] => md5
+ [%d] => sha1
+ [%d] => sha224
+ [%d] => sha256
+ [%d] => sha384
+ [%d] => sha512/224
+ [%d] => sha512/256
+ [%d] => sha512
+ [%d] => sha3-224
+ [%d] => sha3-256
+ [%d] => sha3-384
+ [%d] => sha3-512
+ [%d] => ripemd128
+ [%d] => ripemd160
+ [%d] => ripemd256
+ [%d] => ripemd320
+ [%d] => whirlpool
+ [%d] => tiger128,3
+ [%d] => tiger160,3
+ [%d] => tiger192,3
+ [%d] => tiger128,4
+ [%d] => tiger160,4
+ [%d] => tiger192,4
+ [%d] => snefru
+ [%d] => snefru256
+ [%d] => gost
+ [%d] => gost-crypto
+ [%d] => haval128,3
+ [%d] => haval160,3
+ [%d] => haval192,3
+ [%d] => haval224,3
+ [%d] => haval256,3
+ [%d] => haval128,4
+ [%d] => haval160,4
+ [%d] => haval192,4
+ [%d] => haval224,4
+ [%d] => haval256,4
+ [%d] => haval128,5
+ [%d] => haval160,5
+ [%d] => haval192,5
+ [%d] => haval224,5
+ [%d] => haval256,5
+)