diff --git a/lib/auth.php b/lib/auth.php index 6a21584..481796a 100644 --- a/lib/auth.php +++ b/lib/auth.php @@ -75,7 +75,7 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE // LDAP MD5 case '{md5}' : $hash = ($prefix ? ($canonical ? '{MD5}' : $scheme) : '') . - base64_encode(hex2bin(md5($phrase))); + base64_encode(pkwk_hex2bin(md5($phrase))); break; // LDAP SMD5 @@ -83,13 +83,13 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE // 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 @@ -97,7 +97,7 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE // 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 diff --git a/lib/func.php b/lib/func.php index 92e1fd6..d760dfe 100644 --- a/lib/func.php +++ b/lib/func.php @@ -304,11 +304,11 @@ function encode($key) // 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