Skip to content

Instantly share code, notes, and snippets.

@satyendrakumarsingh
Created April 24, 2024 01:50
Show Gist options
  • Save satyendrakumarsingh/f154cee556b1eb4f3cd440e0f869efc9 to your computer and use it in GitHub Desktop.
Save satyendrakumarsingh/f154cee556b1eb4f3cd440e0f869efc9 to your computer and use it in GitHub Desktop.
php-mac
<?php
function generateHmacSha512($hmacData, $secretKey) {
$hmacValue = hash_hmac('sha512', $hmacData, pack('H*', $secretKey) , true);
return base64_encode($hmacValue);
}
# TEST HMACSHA512 FUNCTION
$hmacData = "satyendra";
$secretKey = "6B58703273357638792F423F4528472B4B6250655368566D597133743677397A";
echo generateHmacSha512($hmacData, $secretKey);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment