PukiWiki
リビジョン | c954cdf4b7987b663180558b380dd792e9852799 (tree) |
---|---|
日時 | 2014-06-02 05:50:11 |
作者 | umorigu <umorigu@gmai...> |
コミッター | umorigu |
Rename 'hex2bin' to 'pkwk_hex2bin' because of PHP 5.4+ compatibility
PHP 5.4 has embedded 'hex2bin', so the pukiwiki-original 'hex2bin'
needs to be given another name.
@@ -75,7 +75,7 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE | ||
75 | 75 | // LDAP MD5 |
76 | 76 | case '{md5}' : |
77 | 77 | $hash = ($prefix ? ($canonical ? '{MD5}' : $scheme) : '') . |
78 | - base64_encode(hex2bin(md5($phrase))); | |
78 | + base64_encode(pkwk_hex2bin(md5($phrase))); | |
79 | 79 | break; |
80 | 80 | |
81 | 81 | // LDAP SMD5 |
@@ -83,13 +83,13 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE | ||
83 | 83 | // MD5 Key length = 128bits = 16bytes |
84 | 84 | $salt = ($salt != '' ? substr(base64_decode($salt), 16) : substr(crypt(''), -8)); |
85 | 85 | $hash = ($prefix ? ($canonical ? '{SMD5}' : $scheme) : '') . |
86 | - base64_encode(hex2bin(md5($phrase . $salt)) . $salt); | |
86 | + base64_encode(pkwk_hex2bin(md5($phrase . $salt)) . $salt); | |
87 | 87 | break; |
88 | 88 | |
89 | 89 | // LDAP SHA |
90 | 90 | case '{sha}' : |
91 | 91 | $hash = ($prefix ? ($canonical ? '{SHA}' : $scheme) : '') . |
92 | - base64_encode(hex2bin(sha1($phrase))); | |
92 | + base64_encode(pkwk_hex2bin(sha1($phrase))); | |
93 | 93 | break; |
94 | 94 | |
95 | 95 | // LDAP SSHA |
@@ -97,7 +97,7 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE | ||
97 | 97 | // SHA-1 Key length = 160bits = 20bytes |
98 | 98 | $salt = ($salt != '' ? substr(base64_decode($salt), 20) : substr(crypt(''), -8)); |
99 | 99 | $hash = ($prefix ? ($canonical ? '{SSHA}' : $scheme) : '') . |
100 | - base64_encode(hex2bin(sha1($phrase . $salt)) . $salt); | |
100 | + base64_encode(pkwk_hex2bin(sha1($phrase . $salt)) . $salt); | |
101 | 101 | break; |
102 | 102 | |
103 | 103 | // LDAP CLEARTEXT and just cleartext |
@@ -304,11 +304,11 @@ function encode($key) | ||
304 | 304 | // Decode page name |
305 | 305 | function decode($key) |
306 | 306 | { |
307 | - return hex2bin($key); | |
307 | + return pkwk_hex2bin($key); | |
308 | 308 | } |
309 | 309 | |
310 | 310 | // Inversion of bin2hex() |
311 | -function hex2bin($hex_string) | |
311 | +function pkwk_hex2bin($hex_string) | |
312 | 312 | { |
313 | 313 | // preg_match : Avoid warning : pack(): Type H: illegal hex digit ... |
314 | 314 | // (string) : Always treat as string (not int etc). See BugTrack2/31 |