renamed hex2bin to be sure not to conflict with future PHP versions
This commit is contained in:
parent
d9fb144fab
commit
23e34081fe
|
@ -186,15 +186,15 @@ function pwd_hash($password, $enabled = true, $hashType = 'SSHA') {
|
|||
$hash = "{CRYPT}" . crypt($password);
|
||||
break;
|
||||
case 'MD5':
|
||||
$hash = "{MD5}" . base64_encode(hex2bin(md5($password)));
|
||||
$hash = "{MD5}" . base64_encode(convertHex2bin(md5($password)));
|
||||
break;
|
||||
case 'SMD5':
|
||||
$salt0 = substr(pack("h*", md5($rand)), 0, 8);
|
||||
$salt = substr(pack("H*", md5($salt0 . $password)), 0, 4);
|
||||
$hash = "{SMD5}" . base64_encode(hex2bin(md5($password . $salt)) . $salt);
|
||||
$hash = "{SMD5}" . base64_encode(convertHex2bin(md5($password . $salt)) . $salt);
|
||||
break;
|
||||
case 'SHA':
|
||||
$hash = "{SHA}" . base64_encode(hex2bin(sha1($password)));
|
||||
$hash = "{SHA}" . base64_encode(convertHex2bin(sha1($password)));
|
||||
break;
|
||||
case 'PLAIN':
|
||||
$hash = $password;
|
||||
|
@ -203,7 +203,7 @@ function pwd_hash($password, $enabled = true, $hashType = 'SSHA') {
|
|||
default: // use SSHA if the setting is invalid
|
||||
$salt0 = substr(pack("h*", md5($rand)), 0, 8);
|
||||
$salt = substr(pack("H*", sha1($salt0 . $password)), 0, 4);
|
||||
$hash = "{SSHA}" . base64_encode(hex2bin(sha1($password . $salt)) . $salt);
|
||||
$hash = "{SSHA}" . base64_encode(convertHex2bin(sha1($password . $salt)) . $salt);
|
||||
break;
|
||||
}
|
||||
// enable/disable password
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2003 - 2011 Roland Gruber
|
||||
Copyright (C) 2003 - 2012 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -624,7 +624,7 @@ class LAMConfig {
|
|||
* @return String hash value
|
||||
*/
|
||||
private function hashPassword($password, $salt) {
|
||||
return "{SSHA}" . base64_encode(hex2bin(sha1($password . $salt))) . " " . base64_encode($salt);
|
||||
return "{SSHA}" . base64_encode(convertHex2bin(sha1($password . $salt))) . " " . base64_encode($salt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1399,7 +1399,7 @@ class LAMCfgMain {
|
|||
* @return String hash value
|
||||
*/
|
||||
private function hashPassword($password, $salt) {
|
||||
return "{SSHA}" . base64_encode(hex2bin(sha1($password . $salt))) . " " . base64_encode($salt);
|
||||
return "{SSHA}" . base64_encode(convertHex2bin(sha1($password . $salt))) . " " . base64_encode($salt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2003 - 2011 Roland Gruber
|
||||
Copyright (C) 2003 - 2012 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -37,7 +37,7 @@ include_once("config.inc");
|
|||
* @param string $value HEX string
|
||||
* @return binary result binary
|
||||
*/
|
||||
function hex2bin($value) {
|
||||
function convertHex2bin($value) {
|
||||
return pack("H*", $value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue