I am using a lot of caching and buffering of API calls in my WWW Framework and one of the things that I end up using all around is 'fingerprinting' data in order to match cache filenames as well as detecting API calls that have already been made.
A lot of data is moved in arrays, like GET, POST and so on. As a result the uniqueness of an API call depends on the data.
As a result I need to fingerprint this information. To do it requires generating a 'fingerprint' from the data array as well and hashing it into a string that I can store and compare against.
For array serialization there is serialize() and json_encode() in PHP. After various benchmarks I consider json_encode() the faster method for serializing an array and am quite happy with it.
For hashing there is md5() and sha1() functions, of which md5() is faster according to my benchmarks.
So my current fingerprint algorithm is:
$fingerprint=md5(json_encode($array));
But I am having doubts whether this is the 'fastest possible' method for fingerprinting an array in PHP. I have tried Google and StackOverflow and have not found good alternatives though. Am I on a right track or do I need to do something different?