mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-01 01:52:18 +01:00
use urldecode(http_build_request()) instead of looping and building request string
This commit is contained in:
parent
2e0dbfa2c3
commit
a8e3d36f80
@ -88,15 +88,7 @@ function UnixToDbTime($unix)
|
||||
// return b64 encoded hmac hash
|
||||
function sign($a, $apiKey) {
|
||||
ksort($a);
|
||||
$qs = '';
|
||||
$n = count($a);
|
||||
$i = 0;
|
||||
foreach (array_keys($a) as $key) {
|
||||
$qs .= trim($key).'='.trim($a[$key]);
|
||||
if (++$i < $n) {
|
||||
$qs .= '&';
|
||||
}
|
||||
}
|
||||
$qs = urldecode(http_build_query($a));
|
||||
|
||||
// the TRUE at the end states we want the raw value, not hexadecimal form
|
||||
$hmac = hash_hmac('sha1', utf8_encode($qs), $apiKey, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user