To check the X-Hub-Signature header sent by Instagram or Facebook callback via web host in PHP version 5.6 or higher, you can use:
if ( hash_equals('sha1=' . hash_hmac('sha1', $postdata, 'mysecret'), $_SERVER['HTTP_X_HUB_SIGNATURE'] )
This is better than using == or === , as the hash_equals method hash_equals prevent temporary attacks.
source share