facebook/hhvm — pull request #2988 by atdt (2014-06-19 12:01:13+00:00)
Title: Allow empty keys in hash_hmac() and hash_hmac_file()

Zend PHP accepts the empty string as a key for hash_hmac() and
hash_hmac_file(), but HHVM doesn't, because its implementation of these
functions delegates to hash_init(), which does not accept an empty key when
HASH_HMAC is specified.

Fix this by exploting the fact that we can sneak an empty key past hash_init()
(on both Zend and HHVM) by sending it "\0" for a key value. "\0" and "" are
equivalent because the HMAC algorithm pads the key to the right with extra
zeros to the input block size of the hash function.