<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<script type="text/javascript" src="base64.js"></script>
<script type="text/javascript" src="encrypt_pwd.js"></script>
<div>生成加密密码</div>
<div><input type="text" name="pwd" id="pwd"> <input type="button" onclick="formSubmit()" value="生成rot13密码"></div>
<div>生成base64密码:<input type="text" name="base64" id="base64"> </div>
<script type="text/javascript">
function formSubmit(){
var pwd = 'a123456';
var rot13_pwd = createPwd(pwd);
console.log(rot13_pwd);
document.getElementById('pwd').value=rot13_pwd;
var html_source = base64.encode(rot13_pwd);
console.log(html_source);
document.getElementById('base64').value=html_source;
}
</script>
</body>
</html>
encrypt_pwd.js 查看地址 https://blog.csdn.net/qq_27782857/article/details/123335794 base64.js下载地址 https://github.com/emn178/hi-base64/blob/master/src/base64.js
public function login()
{
$param = $_POST();
$pwd = str_replace(' ', '+', $param['password']);
$pwd = base64_decode($pwd);
$param['password'] = getInitPwd($pwd);
}
function getInitPwd($pwd){
$pwd = str_replace(' ', '+', $pwd);
$pwd = base64_decode($pwd);
$pwd = substr($pwd, 1, strlen($pwd)-2);
return str_rot13($pwd);
}
|