_javascript techniques for text encryption and decryption implemented by JavaScript

Source: Internet
Author: User
<div ><p> text encryption and decryption </p></div> <script language= "JavaScript" > set8= ""; set4=2;function Set5 (m,n,c,d,e3) {set4=1; lxyer1.style.top=document.body.scrolltop+event.clienty+20; Lxyer1.style.left=event.clientx-150;var t,a,b,f= ' <td align=center onmouseover=this.bgcolor= "#9CA4B6" onmouseout =this.bgcolor= "" '; if (e3==1) var g= "," +eval (m+ ". Value") + ","; t= ' <table ' width=100% cellpadding=3 bgcolor= #CCD1D9 onclick= "lxyer1.style.top=-400" ><tr><td><font color= #9900CC >※</font></td> ' +f+ ' width=53 onclick=\ ' +m+ '. value= "" \ > Clear c</td> ' +f+ ' width=53> off x</td></tr></table> <table width=100% cellpadding=0 cellspacing=0 onmousedown=set4=2;settimeout ("Set4=1",) >; if (d!=null) set8= m+ "^" +d;else set8=m+ "^" +n;a=n.split ("'"); for (b=0;b<a.length;b++) {if (b%c==0) t+= "<tr>"; t+= ' &LT;TD Onmouseover=this.bgcolor= "#cccccc" "onmouseout=this.bgcolor=" "Width=" ' +math.floor (100/c) + '% ' height=20 onclick= '; if (e3!=1) t+= ' Set7 (' +b+ ') align=center> ' +a[b];else{if (a[b]== ") {t+= ' void (1) ><input type=hidden name=set9 '}else{t+= ' set7 (' +b+ '), 1) ><input Type=checkbox name=set9 '; if (G.indexof (", +a[b]+", ")!=-1) t+=" checked "}t+= ' > ' +a[b]}t+=" </td > if (b%c==c-1) t+= "</tr>"}lxyer1.innerhtml=t+ "</table>"}function set7 (m,n) {; var a=set8.split ("^") ; var b=a[1].split ("'"); var obj=eval (a[0]); if (n!=1) {obj.value=b[m]; Lxyer1.style.top=-400;return};var d= "," +obj.value+ ","; if (D.indexof (", +b[m]+,") ==-1) {set9[m].checked=true;d+=b [M]} Else{set9[m].checked=false;d=d.split ("," +b[m]+ ","). Join (",")}d=d.replace (/(^\,+) |\,+$/g, "") Obj.value=d} function Set6 (a,b,c) {; var t=a;for (var x=a+c;x<=b;x+=c) t+= "" +x;return t}document.write (' <textarea name= paste23t ></textarea> '); function Paste3 () {paste23t.select ();d ocument.execcommand ("Paste"); Paste23t.value}function Gt3save (f,n,a) {; var b=a.indexof ("'" +f); if (b==-1) return + "'" +f+n;var a1=a.substr (0,b); var A2=a.substring (b+3) b=a2.indexof ("'"); if (b==-1)A2= ""; else a2=a2.substring (b); return a1+ "'" +f+n+a2}document.body.onmouseup=new Function ("If" (set4==1) lxyer1.style.top=-400 ") </script> <ptml> <pead> <title> text encryption and decryption: Copy your text into the following input box, you can complete the encryption and decryption of text </title> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <meta name=" description "content=" Text encryption and decryption: Copy your text into the following input box, you can complete the encryption and decryption of text "> <meta name=" Keywords "content=" text encryption decryption: Copy your text into the following input box, you can complete the encryption and decryption of text "> <meta http-equiv=" Expires "content=" "0" > <meta http-equiv= "Pragma" content= "No-cache" > <meta http-equiv=refresh content= "> <base onmouseover=" Window.status= ' text encryption decryption: Copy your text into the following input box, you can complete the encryption and decryption of text | qq:1783983 '; return true ' > <link href= ' http://www.knowsky.com/style.css ' rel= ' stylesheet ' type= ' text/css ' > </pead> <body topmargin= "5" leftmargin= "0" marginwidth= "0" marginheight= "0" > <table border= "0" Cellpadd ing= "9" width= "776" align= "center" cellspacing= "0" > <tr> &LT;TD valign= "Top" height= "to" align= "center" class= "t15" > <b> text Encryption and decryption </b></td> </tr> <t R> <td valign= "Top" height= "align=" "Center" > <p><font color= "#333333" > copy your text into the input box below , you can complete the encryption and decryption of the text </font> </td> </tr> <tr> <td valign= "Top" > <table C ellspacing= "0" cellpadding= "0" width= "align=" center "bgcolor=" #fcfcfc "> <tr> <td He ight=15 colspan=2></td> </tr> <tr> <td align= "right" width= "no" > Original String:</td> <td> <textarea id= "AF1" name= "AF1" rows= "ten" ></textarea> <input onclick= ' Af1.select ();d ocument.execcommand ("copy") ' type= ' button ' value= ' Copy ' name= ' button ' > <input onclick= "Af1.value+=paste3 ()" type= "button" value= "Paste" name= "button" > <input onclick= ' AF1. Value= "" ' Type= "button"Value= "Clear" name= "button" > </td> </tr> <tr> <td align= "cen ter "colspan=" 2 "> <input onclick=" af2.value=stoi41 (af1.value) "type=" button "value=" Encrypted ↓ "name=" button "& Gt <input onclick= "Af1.value=i41tos (af2.value)" type= "button" value= "Decrypt ↑" name= "Button2" > </td> </tr> <tr> <td align= "right" > Encryption results:</td> <td> <textarea id= "af2" name= "af2" rows= "ten" ></textarea> <input OnC Lick= ' Af2.select ();d ocument.execcommand ("copy") ' type= button ' value= ' Copy ' name= ' button ' > <input onClick = "Af2.value+=paste3 ()" type= "button" value= "Paste" name= "button" > <input onclick= ' af2.value= ' "' Type=" butt On "value=" clear "name=" button "> </td> </tr> <tr> <td valign = "Top"Align= "Right" >:</td> <td height= "<input" > Id= sdf3 "size=" "Name=" Sdf3 "> </td> </tr> <tr> <td></td> &LT;TD height=25> plus password is composed of 41 different letters of the string, different password, encryption and decryption results are different, encryption results to add the characters in the password as the basic element, plus the password can not have small letter Z, or encrypted with Chinese text may be wrong. </td> </tr> <tr> <td height=15 colspan=2></td> </t r> </table> </td> </tr> </table> </body> </ptml><script LA nguage= "JavaScript" > dt3= "Welcome to use the Text Encryption tool, you can encrypt Chinese characters"; sdf3.value= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE"; function stoi41 (str) {; var t= ""; var a,a1,a2,a3;var b=sdf3.value.split (""); for (Var x=0;x<str.length;x++) {a= Str.charcodeat (x) a1=a%41;a= (A-A1)/41;a2=a%41;a= (a-a2)/41;a3=a%41;t+=b[a3]+b[a2]+b[a1]}a= "Z"; for (Var x=0;x< t.length;x+=3) {if (T.charat (x)!= "A") {return t}a+=t.substr (x+1,2)}return A}function I41tos (str) {; var a1,a2,a3,b=sdf3.value,d=0,t,a;if (str.charat (0) = = "Z") {t=new Array Math.floor ((str.length-1)/ 2) A=t.length;for (var x=0;x<a;x++) {D++;a2=b.indexof (Str.charat (d)) D++;a3=b.indexof (Str.charat (d)) t[x]=a2*41+ A3}};else{t=new Array (Math.floor (STR.LENGTH/3)) A=t.length;for (Var x=0;x<a;x++) {A1=b.indexof (str.charAt (d)) d++ ; A2=b.indexof (Str.charat (d)) D++;a3=b.indexof (Str.charat (d)) D++;t[x]=a1*1681+a2*41+a3}} a=eval (" String.fromCharCode ("+t.join (', ') +") "); return a} </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.