Encryptor

[Total: 0    Average: 0/5]

This shows how to have a file create encrypted code.

Body Code:

The left textarea is where you place your htlm file.<BR><BR>
The right textarea is where the encrypted file will be after
you click on the "ENCRYPT" button.<BR><BR>
Just select all the text in the encrypt textarea and put it
into a file all by itself and it will be ready to put on the net!<BR>
<form name=clearMsg>
<input type=button value="ENCRYPT" onclick="encryptMsg()"><BR>
<textarea name=t1 rows=10 cols=30></textarea>
<textarea name=t2 rows=10 cols=30></textarea>
</form>
<script>
var key = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1029384756><#].";
function encryptMsg() {
  var _msg = document.clearMsg.t1.value;
  var DECRYPT = false;
  var _xmsg = "";
  var _loc;
  var mcH =  key.length / 2;
  var dv;
  _xmsg += "<HTML><HEAD><TITLE>Encrypt</TITLE></HEAD><BODY>";
  _xmsg += "<SCR"+"IPT LANGUAGE='JavaScript'>n";
  _xmsg += "function Decode() { d("";

  for (var x = 0; x < _msg.length; x++) {
    if (_msg.charCodeAt(x) == 13 || _msg.charCodeAt(x) == 10) {_xmsg+=" ";alert("ENTER");}
	else {
      _loc = key.indexOf(_msg.charAt(x));
  	if(_loc==-1) _xmsg+=(_msg.charAt(x)==""")?"\"":_msg.charAt(x);
      if (_loc > mcH) {
        dv = _loc - mcH;
        _xmsg += key.charAt(33 - dv);
  	  
      } else {
          dv = mcH - _loc;
  		if (key.charAt(33+dv)=="<"&& DECRYPT) _xmsg+="&lt;"; else
          _xmsg += key.charAt(33 + dv);
       
      }
	}
  }
  _xmsg += "");}";
  _xmsg += "var DECRYPT = false;var ClearMessage="";function d(msg){ClearMessage += codeIt(msg);}n";
  _xmsg += 'var key = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1029384756><#].";n';
  _xmsg += "func"+"tion codeIt (_message) {var wTG;var mcH =  key.length / 2;n";
  _xmsg += "var _newString = "";var dv;for (var x = 0; x < _message.length; x++) {wTG = key.indexOf(_message.charAt(x));n";
  _xmsg += "if (wTG > mcH) {dv = wTG - mcH;_newString += key.charAt(33 - dv);} else {if (key.indexOf(_message.charAt(x)) < 0)n";
  _xmsg += " {_newString += _message.charAt(x);} else {dv = mcH - wTG;n";
  _xmsg += "_newString += key.charAt(33 + dv);}}}return (_newString);}"
  _xmsg += "Decode();document.write(ClearMessage);</SC"+"RIPT>";
  _xmsg += "</body></html>";

  document.clearMsg.t2.value = _xmsg;
}


///////////////////////


function decryptMsg(_msg) {
  var DECRYPT = false;
  var _xmsg = "";
  var _loc;
  var mcH =  key.length / 2;
  var dv;
  for (var x = 0; x < _msg.length; x++) {
    _loc = key.indexOf(_msg.charAt(x));
	if(_loc==-1) _xmsg+=_msg.charAt(x);
    if (_loc > mcH) {
      dv = _loc - mcH;
      _xmsg += key.charAt(33 - dv);
	  
    } else {
        dv = mcH - _loc;
		if (key.charAt(33+dv)=="<"&& DECRYPT) _xmsg+="&lt;"; else
        _xmsg += key.charAt(33 + dv);
     
    }
  }
  return (_xmsg);
}

</script>

Times Viewed: 3

Leave a Reply

Your email address will not be published. Required fields are marked *