Update security.php
This commit is contained in:
parent
5925e142ab
commit
69b308e4b8
|
@ -177,19 +177,24 @@ if(!function_exists("get_hashed_text")) {
|
||||||
function get_hashed_text($text, $algo="sha1", $options=array()) {
|
function get_hashed_text($text, $algo="sha1", $options=array()) {
|
||||||
$hashed_text = false;
|
$hashed_text = false;
|
||||||
|
|
||||||
|
// with salt
|
||||||
if(!array_key_empty("salt", $options)) {
|
if(!array_key_empty("salt", $options)) {
|
||||||
if(!array_key_equals("salt2p", $options, true)) {
|
if(!array_key_equals("2pass", $options, true)) {
|
||||||
if($options['salt'] == true) {
|
if($options['salt'] == true) {
|
||||||
$text .= get_salt();
|
$text .= get_salt();
|
||||||
} elseif(is_string($options['salt']) && $strlen($options['salt']) > 0) {
|
} elseif(is_string($options['salt']) && $strlen($options['salt']) > 0) {
|
||||||
$text .= $options['salt'];
|
$text .= $options['salt'];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$options['salt2p'] = false;
|
|
||||||
$text = get_hashed_text($text, $algo, $options);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with 2-pass
|
||||||
|
if(array_key_equals("2pass", $options, true)) {
|
||||||
|
$options['2pass'] = false;
|
||||||
|
$text = get_hashed_text($text, $algo, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// choose algorithm
|
||||||
switch($algo) {
|
switch($algo) {
|
||||||
case "sha1":
|
case "sha1":
|
||||||
$hashed_text = sha1($text);
|
$hashed_text = sha1($text);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user