用dhtml做了一个密码管理器[5]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 emu 的 blog

  && (q2 = prompt("please enter second new question:",question2))!=null
  && (a2 = prompt("please enter answer of second question:",""))!=null
  && (q3 = prompt("please enter third new question:",question3))!=null
  && (a3 = prompt("please enter answer of third question:",""))!=null)
 question1 = q1;
 question2 = q2;
 question3 = q3;
 reminder = key.xor(generatekeybypwd("answer1:"+a1)).xor(generatekeybypwd("answer2:"+a2)).xor(generatekeybypwd("answer3:"+a3));
 answermd5 = md5("answers:"+escape(a1+a2+a3));
 storepwds();
}


function modifytitle(e){
 var oldtitle = e.innertext;
 var spwd = e.nextsibling.innertext;
 var newtitle = prompt("please enter new password title",oldtitle);
 if (!newtitle) return;
 pwds[escape(oldtitle.xor())]=null;
 pwds[escape(newtitle.xor())]=escape(spwd.xor());
 storepwds();
 showpwds();
}
function modifypwd(e){
 var stitle = e.previoussibling.innertext;
 var oldpwd = e.innertext
 var newpwd = prompt("please enter new password",oldpwd);
 if (!newpwd) return;
 pwds[escape(stitle.xor())]=escape(newpwd.xor());
 storepwds();
 showpwds();
}

function removepwd(k){
 pwds[k]=null;
 storepwds();
 showpwds();
}
function createpwd(){
 var charset = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789";
 var result = "";
 var st = md5((new date()-math.random()).tostring())+md5((new date()+math.random()).tostring());
 for (var i=0;i<st.length;i+=2)
  result += charset.charat(parseint(st.substr(i,2),16)%charset.length)
 clipboarddata.setdata('text',result);
 alert("generated password \""+result+"\" was copied into clipboard.");
}

function generatekeybypwd(p){
 return unescape((md5(p)+md5(p+" ")+md5(p+"+")+md5(p+"-")).replace(/(....)/g,"%u$1"))
}
//-->
</script>
</head>
<body>
 <div id=content></div>
 <br>
 <center>
  <button onclick="addpwd()" disabled>add new<br>password item</button> &nbsp;
  <button onclick="changeaccesspwd()" disabled>change access<br>password</button> &nbsp;
  <button onclick="changeaccesspwdremander()" disabled>change access<br>password remander</button> &nbsp;
  <button onclick="createpwd()" disabled>create a new<br>random password</button> &nbsp;
 </center>
</body>
</html>

本文关键:emu 加密 解密
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top