How to get PHP to create HMAC-SHA1 strings like Objective-C? How to get PHP to create HMAC-SHA1 strings like Objective-C? php php

How to get PHP to create HMAC-SHA1 strings like Objective-C?


Okay, I'll add a faux answer. (On Stackoverflow every question should be decorated by an answer.)

The hash functions in PHP mostly return hex-strings, not the real data. (For whatever reason). There is usually a function parameter to make it compatible to what other implementations expect:

 hash_hmac("sha1", $data, $key, $raw_output=TRUE); md5($str, $raw_output=TRUE); hash("sha1", $data, $raw_output=TRUE);