Created
January 16, 2015 16:06
-
-
Save czj/485a2f5941ebb489b5b9 to your computer and use it in GitHub Desktop.
FIA-NET / Certissim's HMAC SHA1 checksum
This file contains hidden or 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
Et le code d'appel en Ruby 📡