// LDAP MD5
case '{md5}' :
$hash = ($prefix ? ($canonical ? '{MD5}' : $scheme) : '') .
- base64_encode(hex2bin(md5($phrase)));
+ base64_encode(pkwk_hex2bin(md5($phrase)));
break;
// LDAP SMD5
// MD5 Key length = 128bits = 16bytes
$salt = ($salt != '' ? substr(base64_decode($salt), 16) : substr(crypt(''), -8));
$hash = ($prefix ? ($canonical ? '{SMD5}' : $scheme) : '') .
- base64_encode(hex2bin(md5($phrase . $salt)) . $salt);
+ base64_encode(pkwk_hex2bin(md5($phrase . $salt)) . $salt);
break;
// LDAP SHA
case '{sha}' :
$hash = ($prefix ? ($canonical ? '{SHA}' : $scheme) : '') .
- base64_encode(hex2bin(sha1($phrase)));
+ base64_encode(pkwk_hex2bin(sha1($phrase)));
break;
// LDAP SSHA
// SHA-1 Key length = 160bits = 20bytes
$salt = ($salt != '' ? substr(base64_decode($salt), 20) : substr(crypt(''), -8));
$hash = ($prefix ? ($canonical ? '{SSHA}' : $scheme) : '') .
- base64_encode(hex2bin(sha1($phrase . $salt)) . $salt);
+ base64_encode(pkwk_hex2bin(sha1($phrase . $salt)) . $salt);
break;
// LDAP CLEARTEXT and just cleartext
// Decode page name
function decode($key)
{
- return hex2bin($key);
+ return pkwk_hex2bin($key);
}
// Inversion of bin2hex()
-function hex2bin($hex_string)
+function pkwk_hex2bin($hex_string)
{
// preg_match : Avoid warning : pack(): Type H: illegal hex digit ...
// (string) : Always treat as string (not int etc). See BugTrack2/31