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

23 lines
710 B
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_default{
/**
* 加密密码
* @param string $source_str 原始密码
* @param int $is_hash256 是否使用SHA256加密1=是0=否)
* @return string 加密后的密码
*/
public static function get_encrypted($source_str, $is_hash256 = 0){
$md5_hash = md5($source_str);
// 如果 is_hash256=1在MD5基础上再进行SHA256加密
if ($is_hash256 == 1) {
return hash('sha256', $md5_hash);
}
// 否则只使用MD5加密兼容旧密码
return $md5_hash;
}
}