If your like me, you probably hate those Javascripts witch open a "Right Click Disabled" prompt. An easier way to confuse pirates from stealing your hard worked scripts or codes you can easily encrypt your html.
In this tut i will show you how to both create an html encrypting script and will show you the diffrent methods of encryption.
1. The HEX DECIMAL Encryptor. (Effectiveness 9/10)
This encryptor will turn html code like this
CODE
<html>
<body>
<p> test1 </p>
</body>
</html>
into
CODE
%3C%68%74%6D%6C%3E%0A%3C%62%6F%64%79%3E%0A%3C%70%3E%20%74%65%73%74%31%20%3C%2F%70%3E%0A%3C%2F%62%6F%64%79%3E%0A%3C%2F%68%74%6D%6C%3E
For a already made version, click here
This method is my personal favorite.
First, put this in your scripts body
CODE
<script language=Javascript>
<!--
function encode(){
if(document.forms[0].asciitext.value == ''){
alert('Please enter some code to encrypt.');
void(0);
}
else {
var text= document.forms[0].asciitext.value;
enctext= transform(text);
document.forms[0].asciitext.value= '';
document.forms[0].asciitext.value= (enctext);
}
}
function transform(s){
var hex=''
var i
for (i=0; i<s.length; i++)
{
hex += '%'+hexfromdec( s.charCodeAt(i) )
}
return hex
}
function generate(){
if(document.forms[0].asciitext.value == ''){
alert('Please encrypt something!');
void(0);
}
else {
var text= document.forms[0].asciitext.value;
document.forms[0].asciitext.value="\<script\>\n//<!--\ndocument.write(unescape(\""+text+"\"));\n//-->\n\</script\>";
}
}
function hexfromdec(num) {
if (num > 65535) { return ("err!") }
first = Math.round(num/4096 - .5);
temp1 = num - first * 4096;
second = Math.round(temp1/256 -.5);
temp2 = temp1 - second * 256;
third = Math.round(temp2/16 - .5);
fourth = temp2 - third * 16;
return (""+getletter(third)+getletter(fourth));
}
function getletter(num) {
if (num < 10) {
return num;
}
else {
if (num == 10) { return "A" }
if (num == 11) { return "B" }
if (num == 12) { return "C" }
if (num == 13) { return "D" }
if (num == 14) { return "E" }
if (num == 15) { return "F" }
}
}
function decode(){
if (document.forms[0].asciitext.value=="") {alert('No code to decrypt!');}
else {document.forms[0].asciitext.value=unescape(document.forms[0].asciitext.value);document.forms[0].asciitext.value="Click Encrypt to encrypt the code.";}
}
function preview(){
if (document.forms[0].asciitext.value=="") {alert('Nothing to preview!');}
else {pr=open("","_blank","top=0,left=0");
pr.document.write(document.forms[0].asciitext.value);
pr.document.title='Preview';
}
}
//--></SCRIPT>
this is what makes the entire thin "tick".
Now insert this to make the text fields, buttons and phisical appearence
CODE
<FORM name=code action="" method=post>
<TABLE cellSpacing=0 cellPadding=0 bgColor=#000000 border=3 align="center">
<TBODY>
<TR>
<TD bgColor=#6699CC> <font color="#FFFFFF">HTML Encrypter 1: </font><BR>
<TEXTAREA name=asciitext rows=10 wrap=virtual cols=69>Type the code to be encrypted here.</textarea>
</TD></TR>
<TR>
<TD bgColor=#6699CC>
<P>
<INPUT class=button onclick=encode() type=button value="Encrypt" name=Button2>
</P></TD></TR></TBODY></TABLE>
</FORM>
</td>
</tr>
</table>
2. The FIGURE HEX DECIMAL Method (Effectiveness 4/10)
This Encryption will turn a code like this
CODE
<html>
<body>
<p> test1 </p>
</body>
</html>
into
CODE
<script>
<!--
document.write(unescape("%3Chtml%3E%0A%3Cbody%3E%0A%3Cp%3E%20test1%20%3C/p%3E%0A%3C/body%3E%0A%3C/html%3E"));
//-->
</script>
The problem with this is that you can make out certain words out
Ex.
<script>
<!--
document.write(unescape("%3Chtml%3E%0A%3Cbody%3E%0A%3Cp%3E%20test1%20%3C/p%3E%0A%3C/body%3E%0A%3C/html%3E"));
//-->
</script>
This by far is my least favorite method.
For a already made version, click here
If you wish to make the aplication yourself, here's the code.
CODE
<script language=JavaScript>
var i=0;
var ie=(document.all)?1:0;
var ns=(document.layers)?1:0;
function initStyleElements() /* Styles for Buttons Init */
{
var c = document.pad;
if (ie)
{
//c.text.style.backgroundColor="#DDDDDD";
c.compileIt.style.backgroundColor="#C0C0A8";
c.compileIt.style.cursor="hand";
c.select.style.backgroundColor="#C0C0A8";
c.select.style.cursor="hand";
c.view.style.backgroundColor="#C0C0A8";
c.view.style.cursor="hand";
c.retur.style.backgroundColor="#C0C0A8";
c.retur.style.cursor="hand";
c.clear.style.backgroundColor="#C0C0A8";
c.clear.style.cursor="hand";
}
else return;
}
/* Buttons Enlightment of "Compilation" panel */
function LightOn(what)
{
if (ie) what.style.backgroundColor = '#E0E0D0';
else return;
}
function FocusOn(what)
{
if (ie) what.style.backgroundColor = '#EBEBEB';
else return;
}
function LightOut(what)
{
if (ie) what.style.backgroundColor = '#C0C0A8';
else return;
}
function FocusOff(what)
{
if (ie) what.style.backgroundColor = '#DDDDDD';
else return;
}
/* Buttons Enlightment of "Compilation" panel */
function generate() /* Generation of "Compilation" */
{
code = document.pad.text.value;
if (code)
{
document.pad.text.value='Compiling...Please wait!';
setTimeout("compile()",1000);
}
else alert('First enter something to compile and then press CompileIt')
}
function compile() /* The "Compilation" */
{
document.pad.text.value='';
compilation=escape(code);
document.pad.text.value="<script>\n<!--\ndocument.write(unescape(\""+compilation+"\"));\n//-->\n<\/script>";
i++;
if (i=1) alert("Page compiled 1 time!");
else alert("Page compiled "+i+" times!");
}
function selectCode() /* Selecting "Compilation" for Copying */
{
if(document.pad.text.value.length>0)
{
document.pad.text.focus();
document.pad.text.select();
}
else alert('Nothing for be selected!')
}
function preview() /* Preview for the "Compilation" */
{
if(document.pad.text.value.length>0)
{
pr=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=700,height=320,left=50,top=110");
pr.document.write(document.pad.text.value);
}
else alert('Nothing for be previewed!')
}
function uncompile() /* Decompiling a "Compilation" */
{
if (document.pad.text.value.length>0)
{
source=unescape(document.pad.text.value);
document.pad.text.value=""+source+"";
}
else alert('You need compiled code to uncompile it!')
}
// -->
</script>
This Gives it the fuctions
now insert this code to help both compilation and phisical appearence
CODE
<body bgcolor=white topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 onload=initStyleElements()>
<table border=0 width=100% cellspacing=0 cellpadding=0>
<tr>
<td width=100% height="23"></td>
</tr>
<tr>
<td width=100% height=23></td>
</tr>
<tr>
<td width=100%>
<!-- Compilation Panel -->
<form method=post name=pad align=center>
<table width="62%" border="2" bordercolor="#6699FF">
<tr>
<td bgcolor="#6699FF"><font color="#FFFFFF">HTML Encryption 2</font></td>
</tr>
<tr>
<td bgcolor="#6699FF">
<textarea rows=11 name=text cols=58 style="background-color:#EBEBEB;width:95%"></textarea>
</td>
</tr>
<tr>
<td bgcolor="#6699FF">
<input type=button value=Encrypt name=compileIt onClick=generate() onMouseOver=LightOn(this) onMouseOut=LightOut(this)>
</td>
</tr>
</table>
<br>
</form>
<!-- Compilation Panel -->
</td>
</tr>
</table>
Well That's all, I hope you enjoyed my tut and found it useful.!!!!
Feel free to post or e-mail me your questions or comments



