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);
|
$hash = "{CRYPT}" . crypt($password);
|
||||||
break;
|
break;
|
||||||
case 'MD5':
|
case 'MD5':
|
||||||
$hash = "{MD5}" . base64_encode(hex2bin(md5($password)));
|
$hash = "{MD5}" . base64_encode(convertHex2bin(md5($password)));
|
||||||
break;
|
break;
|
||||||
case 'SMD5':
|
case 'SMD5':
|
||||||
$salt0 = substr(pack("h*", md5($rand)), 0, 8);
|
$salt0 = substr(pack("h*", md5($rand)), 0, 8);
|
||||||
$salt = substr(pack("H*", md5($salt0 . $password)), 0, 4);
|
$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;
|
break;
|
||||||
case 'SHA':
|
case 'SHA':
|
||||||
$hash = "{SHA}" . base64_encode(hex2bin(sha1($password)));
|
$hash = "{SHA}" . base64_encode(convertHex2bin(sha1($password)));
|
||||||
break;
|
break;
|
||||||
case 'PLAIN':
|
case 'PLAIN':
|
||||||
$hash = $password;
|
$hash = $password;
|
||||||
|
@ -203,7 +203,7 @@ function pwd_hash($password, $enabled = true, $hashType = 'SSHA') {
|
||||||
default: // use SSHA if the setting is invalid
|
default: // use SSHA if the setting is invalid
|
||||||
$salt0 = substr(pack("h*", md5($rand)), 0, 8);
|
$salt0 = substr(pack("h*", md5($rand)), 0, 8);
|
||||||
$salt = substr(pack("H*", sha1($salt0 . $password)), 0, 4);
|
$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;
|
break;
|
||||||
}
|
}
|
||||||
// enable/disable password
|
// enable/disable password
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -624,7 +624,7 @@ class LAMConfig {
|
||||||
* @return String hash value
|
* @return String hash value
|
||||||
*/
|
*/
|
||||||
private function hashPassword($password, $salt) {
|
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
|
* @return String hash value
|
||||||
*/
|
*/
|
||||||
private function hashPassword($password, $salt) {
|
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$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
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
|
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
|
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
|
* @param string $value HEX string
|
||||||
* @return binary result binary
|
* @return binary result binary
|
||||||
*/
|
*/
|
||||||
function hex2bin($value) {
|
function convertHex2bin($value) {
|
||||||
return pack("H*", $value);
|
return pack("H*", $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue