Update security.php

This commit is contained in:
Namhyeon Go 2018-09-26 20:30:28 +09:00 committed by GitHub
parent 5925e142ab
commit 69b308e4b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,19 +177,24 @@ if(!function_exists("get_hashed_text")) {
function get_hashed_text($text, $algo="sha1", $options=array()) {
$hashed_text = false;
// with salt
if(!array_key_empty("salt", $options)) {
if(!array_key_equals("salt2p", $options, true)) {
if(!array_key_equals("2pass", $options, true)) {
if($options['salt'] == true) {
$text .= get_salt();
} 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) {
case "sha1":
$hashed_text = sha1($text);