I'm missing the functionality to get a list of registered hash functions so one can probe whether a certain hash function is available or not.

There is now :)

array hash_algos(void)
Returns numerically indexed array of hashing engine names.

And just incase anyone missed it. The proto for hash_init() has been extended:

resource hash_init(string algo[, int options, string key])

Options currently has one possible value: HASH_HMAC
When specified, key must be specified as well (to be used for the HMAC key).

HMAC can be used with any of the hashing algos included in ext/hash.
Examples of using HMAC with official test vectors can be found in tests/hmac-md5.phpt

I'd rather not complicate the proto for the core hash() function with HMAC and other options, but maybe a separate hash_hmac() and/or hash_hmac_file() might be in order?

-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to