JS Simple Encryption

Source: Internet
Author: User

Simple JS Encryption and decryption
Code for the corresponding string, h for (2,8,10,16) is the binary to be turned into
Function en (Code, h) { var monyer = new Array (); var i,s; for (i=0;i<code.length;i++)
is to turn the string into a ASCLL code, and then turn it into a few binary return monyer you want;
Ditto function de (code, h) {var i,s= "", Code = Code.split ("_"); for (i=0;i<code.length;i++) {s + = String.fromCharCode ( parseint (Code[i],h));}; return s};

  

Http://www.cnblogs.com/52cik/archive/2014/06/26/js-hide-code.html

Use 0 wide characters to hide, good thing, I'll take a walk.

function En (str) {var rep = {' xx ': ' \u200b ', ' a ': ' \u200c ', ' Ten ': ' \u200d ', ' One ': ' \ufeff '};str = str.replace (/[^\x00-\xff] /g, function (a) {//Transcode characters other than Latin-1 code. Return Escape (a). Replace ('% ', ' \ \ ');}); str = str.replace (/[\s\s]/g, function (a) {//processes binary data and replaces data A = A.charcodeat (). toString (2); a = A.length < 8? Array (9-a.length). Join (' 0 ') + a:a;return a.replace (/... /g, function (a) {return rep[a];}); return str;}; Function de (str) {return str.replace (/.{ 4}/g,function (a) {var rep={"\u200b": "XX", "\u200c": "$", "\u200d": "Ten", "\ufeff": "One"};return string.fromcharcode ( parseint (A.replace (/./g, function (a) {return rep[a]}), 2)})};

This is encrypted and decrypted.
Http://ucren.com/demos/code-hider/index.html

  

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.