Files
OMS/app/pam/lib/encrypt.php
2025-12-28 23:13:25 +08:00

33 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
class pam_encrypt{
/**
* 获取加密后的密码
* @param string $password 原始密码
* @param string $account_type 账户类型
* @param int|null $is_hash256 是否使用SHA256加密1=是0=否默认为1新加密方式
* @return string 加密后的密码
*/
public static function get_encrypted_password($password, $account_type, $is_hash256 = null){
// 如果没有传入 is_hash256默认使用新加密方式1
if ($is_hash256 === null) {
$is_hash256 = 1;
} else {
$is_hash256 = intval($is_hash256);
}
$encrypt = kernel::service('encrypt_'.$account_type);
if(is_object($encrypt)){
if(method_exists($encrypt,'get_encrypted')){
return $encrypt->get_encrypted($password, $is_hash256);
}
}else{
$encrypt = kernel::single('pam_encrypt_default');
}
return $encrypt->get_encrypted($password, $is_hash256);
}
}