2022-05-20 19:21:39 +08:00

45 lines
1.3 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 GHINK Network Studio
Author: Bigsk(https://www.xiaxinzhe.cn)
*/
error_reporting(0);
if(!defined('IN_SYS')){//Defined entreance security.
header('HTTP/1.1 403 Forbidden');
exit(file_get_contents(setting::root."template/403.html"));
}
//哈希库
class hash{
//MD5计算用于接口对接的预留
function cryptMD5($disencrypted){
return md5($disencrypted);
}
//密码生成算法,非时效性
function generatePass($pass){
for ($i=0;$i<=strlen($pass);$i++){
$pass=$this->cryptMD5($pass);
}
return $pass;
}
//Token生成算法时效性
function generateToken($value){
$time=time();
for ($i=0;$i<=strlen($value);$i++){
$result=$result+$this->cryptMd5($value)+$time;
}
return $this->cryptMd5($result);
}
//sId与sKey生成算法唯一性
function generateSIdKey($name){
$time=time();
for ($i=0;$i<=strlen($name);$i++){
@$result=$result+$name+$this->cryptMd5($name)+$time;
}
$sId=$this->cryptMd5($result);
for ($i=0;$i<=strlen($name);$i++){
@$result=$result+$time+$this->cryptMd5($name)+$name;
}
$sKey=$this->cryptMd5($result);
return array($sId,$sKey);
}
}