| 网站首页 | 新闻中心 | 系统安全 | 网络安全 | 安全技术 | 下载中心 | 安全365社区 |
安全365
收藏本站
设为首页
会员登录:
站内搜索: 新闻中心 系统安全 网络安全 安全技术 下载中心
| 安全技术首页 | 技术研究 | 技术应用 | 数据安全 | 企业专区 |
织梦密码的加密与解密
织梦密码的加密与解密程序
作者:佚名 文章来源:互联网 点击数: 更新时间:2008-5-8 8:59:00

  织梦加密解密超强的页面加密:
<SCRIPT language=JavaScript>
<!-- Begin
function encrypt(str, pwd) {
if(pwd == null || pwd.length <= 0) {
    alert("Please enter a password with which to encrypt the message.");
    return null;
}
var prand = "";
for(var i=0; i<pwd.length; i++) {
    prand += pwd.charCodeAt(i).toString();
}
var sPos = Math.floor(prand.length / 5);
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
var incr = Math.ceil(pwd.length / 2);
var modu = Math.pow(2, 31) - 1;
if(mult < 2) {
    alert("Algorithm cannot find a suitable hash. Please choose a different password. \nPossible considerations are to choose a more complex or longer password.");
    return null;
}
var salt = Math.round(Math.random() * 1000000000) % 100000000;
prand += salt;
while(prand.length > 10) {
    prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
}
prand = (mult * prand + incr) % modu;
var enc_chr = "";
var enc_str = "";
for(var i=0; i<str.length; i++) {
    enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255));
    if(enc_chr < 16) {
      enc_str += "0" + enc_chr.toString(16);
    } else enc_str += enc_chr.toString(16);
    prand = (mult * prand + incr) % modu;
}
salt = salt.toString(16);
while(salt.length < 8)salt = "0" + salt;
enc_str += salt;
return enc_str;
}
function decrypt(str, pwd) {
if(str == null || str.length < 8) {
    alert("A salt value could not be extracted from the encrypted message because it's length is too short. The message cannot be decrypted.");
    return;
}
if(pwd == null || pwd.length <= 0) {
    alert("Please enter a password with which to decrypt the message.");
    return;
}
var prand = "";
for(var i=0; i<pwd.length; i++) {
    prand += pwd.charCodeAt(i).toString();
}
var sPos = Math.floor(prand.length / 5);
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
var incr = Math.round(pwd.length / 2);
var modu = Math.pow(2, 31) - 1;
var salt = parseInt(str.substring(str.length - 8, str.length), 16);
str = str.substring(0, str.length - 8);
prand += salt;
while(prand.length > 10) {
    prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
}
prand = (mult * prand + incr) % modu;
var enc_chr = "";
var enc_str = "";
for(var i=0; i<str.length; i+=2) {
    enc_chr = parseInt(parseInt(str.substring(i, i+2), 16) ^ Math.floor((prand / modu) * 255));
    enc_str += String.fromCharCode(enc_chr);
    prand = (mult * prand + incr) % modu;
}
return enc_str;
}
// End -->
</SCRIPT>

<FORM name=box>
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD colSpan=3><TEXTAREA name=ipt rows=5 wrap=virtual cols=40>Welcome to wzwzx.net</TEXTAREA> </TD></TR>
<TR height=50>
<TD vAlign=top><INPUT onclick="document.box.opt.value= encrypt(document.box.ipt.value, document.box.pwd.value);" type=button value=加密> </TD>
<TD vAlign=center align=middle><INPUT value=password name=pwd> </TD>
<TD vAlign=bottom align=right><INPUT onclick="document.box.ipt.value= decrypt(document.box.opt.value, document.box.pwd.value);" type=button value=解密> </TD></TR>
<TR>
<TD colSpan=3><TEXTAREA name=opt rows=5 wrap=virtual cols=40></TEXTAREA> </TD></TR></TBODY></TABLE></CENTER></FORM>

文章录入:小张    责任编辑:小张 
  • 上一篇文章:

  • 下一篇文章: 没有了
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
     
     
     
    没有相关文章
    站长邮箱:webmaster@anquan365.com
    联系电话:86-10-67634029 点击这里给我发消息

    Copyright © 2006-2008 www.anquan365.com 北京华安普特网络科技有限公司 版权所有