Remove Possibility of Timing Attacks

https://www.isecpartners.com/blog/2011/february/double-hmac-verification.aspx

Let's not compare hashes in a way that creates cryptographic
side-channels.

When you compare two hashes with the `==` or `===` operators, PHP will
internally use `memcmp()` which returns false after the first byte fails
to match. This creates a side-channel (known in the literature as a
timing attack).

This patch uses hash_hmac() of the expected and supplied strings with a
random 32-byte nonce (a number to be used once) for each comparison,
thus making timing attacks useless. (The output for the comparison
operation is no longer attacker-controllable, so attempting to measure
the time an request takes to fail is useless.)