Text encryption and decryption implemented by javascript

Source: Internet
Author: User

Text encryption and decryption <ptml> <pead> <title> text encryption and decryption: Copy your text to the following input box, you can complete text encryption and decryption </title> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "> <meta name =" description "content =" text encryption and decryption: Copy your text to the following input box, you can complete text encryption and decryption "> <meta name =" keywords "content =" text encryption and decryption: Copy your text to the following input box, you can complete text encryption and decryption "> <META HTTP-EQUIV =" expires "CONTENT =" 0 "> <META HTTP-EQUIV =" Pragma "CONTENT =" no-cache "> <meta http- equiv = refresh contents = "200"> <Base onmouseover = "window. status = 'text encryption and decryption: Copy your text to the following input box to complete text encryption and decryption | QQ: 8080 '; 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" cellpadding = "9" style = "BORDER-COLLAPSE: collapse "width =" 776 "align =" center "cellspacing =" 0 "> <tr> <td valign =" top "height =" 31" Align = "center" class = "t15"> <B> text encryption and decryption </B> </td> </tr> <td valign = "top" height = "25" align = "center"> <p> copy your text to the following input box, you can complete text encryption and decryption </td> </tr> <td valign = "top"> <table cellspacing = "0" cellpadding = "0" width =" 600 "align =" center "style =" BORDER: #98a7b8 1px solid; "bgcolor =" # fcfcfc "> <tr> <td height = 15 colspan = 2> </td> </tr> <td align =" right "width = "80"> original string: </td> <pre class = "code" id = "Af1" style = "WIDTH: 98%" name = "af1" rows = "10"> </textarea> <input onclick+'af1.select({document.exe cCommand ("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> <td align = "center" colspan = "2"> <input onClick = "af2.value = stoi41 (af1.value) "ty Pe = "button" value = "encrypted signature" name = "button"> <input onClick = "af1.value = i41tos (af2.value) "type =" button "value =" decrypt "name =" button2 "> </td> </tr> <td align =" right "> encryption result: </td> <pre class = "code" id = "af2" style = "WIDTH: 98% "name =" af2 "rows =" 10 "> </textarea> <input onclick+'af2.select(registry.document.exe cCommand (" Copy ") 'Type = "button" value = "copy" name = "button"> <input onClick = "af2.value + = Paste3 ()" type = "bu Tton "value =" Paste "name =" button "> <input onClick = 'af2. value = "" 'Type = "button" value = "clear" name = "button"> </td> </tr> <td valign = "top" align = "right"> ciphertext characters: </td> <td height = "36"> <input id = "sdf3" size = "60" name = "sdf3"> </td> </tr> <tr> <td> </td> <td height = 25> the password is a string consisting of 41 different letters, different passwords have different encryption and decryption results. The encryption result uses the characters in the password as the basic element, and the password cannot contain uppercase letters. Otherwise, the encrypted Chinese text may fail. </Td> </tr> <td height = 15 colspan = 2> </td> </tr> </table> </td> </tr> </table> </body> </ptml> <script language = "javascript"> dt3 = "welcome to the text encryption tool, chinese characters can be encrypted "; sdf3.value =" 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZabcde "; 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
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

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.