Pluf Framework

Pluf Framework Commit Details


Date:2010-02-03 06:15:18 (14 years 10 months ago)
Author:Loic d'Anterroches
Branch:develop, master
Commit:1050261a272731eca2ef3e8e83d8d73e81022ed1
Parents: e30756210f2a8ba8ceb730449687e8373a78de3e
Message:Correctly use the builtin function.

Changes:

File differences

src/Pluf/Sign.php
165165
166166
167167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
168
192169
193170
*/
public static function base64_hmac($value, $key)
{
return Pluf_Utils::urlsafe_b64encode(self::hmac_sha1($key, $value));
}
/**
* HMAC-SHA1 function.
*
* @see http://us.php.net/manual/en/function.sha1.php#39492
*
* @param string Key
* @param string Data
* @return string Calculated binary HMAC-SHA1
*/
public static function hmac_sha1($key, $data)
{
if (strlen($key) > 64) {
$key = pack('H*', sha1($key));
}
$key = str_pad($key, 64, chr(0x00));
$ipad = str_repeat(chr(0x36), 64);
$opad = str_repeat(chr(0x5c), 64);
return pack('H*',sha1(($key^$opad).pack('H*',sha1(($key^$ipad).$data))));
return bin2hex($hmac);
return Pluf_Utils::urlsafe_b64encode(hash_hmac('sha1', $value, $key, true));
}
}

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.05974s using 13 queries.