Modified logic to compare hmac, to account for availability of compare_digest from 2.7.7 onwards