Created
January 16, 2015 09:41
-
-
Save czj/033c14538aa01f1d10e7 to your computer and use it in GitHub Desktop.
FIANET / Certissim SHA1 + HMAC signature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
// Check http://cl.ly/2o0z0z1G103O for documentation on Certissim's HMAC SHA1 | |
// First parameter = hexadecimal key | |
$key_hex = $argv[1]; | |
// Second = string to get signature | |
$payload = $argv[2]; | |
// Convert to binary string | |
$key_bytes = pack('H*', $key_hex); | |
// SHA1 with binary string key | |
$auth = hash_hmac('sha1', $payload, $key_bytes, FALSE); | |
echo $auth; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment