HHVM throws a fatal error when $key is not a string (unlike $data which
is typecast), so we might as well as throw an exception so that
at least we have a stack trace.
Bug: T126316
Change-Id: Iad9a499b51647c7dbcd58e9ab7ac8e8cb6359bba
MWCryptRand already has some useful utility functions wrapping PHP's
hash() and hash_hmac(). Let's make them public so we can use them from
other code.
But since "MWCryptRand" isn't really a good place for hashing functions,
let's move them to "MWCryptHash" instead.
Change-Id: I7542c719ac72beba7b0f6aa170bdb4c69fa6beab