Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Encryptor

  1. #1
    mex
    mex is offline
    Regular Coder
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Encryptor

    The below is a simple script to encrypt!!! Can anyone help me out so that it can decrypt the stuff again back to its original code....

    <html><script language="JavaScript"><!--

    i=0;
    s=0;
    num=0;
    seq1="",seq2="";

    ie = document.all?1:0;
    ns = document.layers?1:0;
    ns6 = document.getElementById?1:0;
    svet = "";

    function generate(what)
    {
    code = document.pad.text;
    if (code.value.length>0) code.value = "<script language=JavaScript>m='"+escape(code.value)+"';d=unescape(m);document.write(d);<\/script>";
    else if (code.value.length == "")
    {
    alert('Hey PASTE the html before clicking that stuff');
    document.pad.text.focus();
    }
    }

    function selectCode()
    {
    padText=document.pad.text;
    if(padText.value.length>0)
    {
    if (ie)
    {
    therange=padText.createTextRange();
    therange.execCommand("Copy");
    window.status="Encrypted HTML copied to Clipboard!";
    setTimeout("window.status=''",1800);
    }
    padText.focus();
    padText.select();
    }
    else alert('Please paste your HTML code into the box first...')
    }

    function dothisfirst(what, message)
    {
    if (ie||ns6)
    {
    window.status=message;
    what.style.backgroundColor='#EAEAEA';
    what.style.cursor='hand';
    }
    else window.status=message;
    }
    function thendothis(what)
    {
    if (ie||ns6)
    {
    what.style.backgroundColor='white';
    window.status='';
    }
    else window.status='';
    }
    // --></script>
    </p><center>
    <table border="0" width="100%" cellspacing="0" cellpadding="5" style="border-collapse: collapse" bordercolor="#111111">
    <tr>
    <td valign="top" align="left">
    <center><font size="2" color="#008000" face="Arial"><i>
    <b>Paste original HTML in the box:</b></i></font></center>
    <form method="post" name="pad" align="center">
    <table border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
    <tr>
    <td width="425">
    <textarea nowrap class="box" rows="15" name="text" cols="77" wrap></textarea></td>
    </tr>
    <tr>
    <td width="425">
    <br>
    <div align="center">
    <center>
    <table border="0" width="100%" cellspacing="6" cellpadding="0">
    <tr>
    <td width="100%" align="center"><input class="but" type="button" value="Encrypt HTML" name="compileIt" onClick="generate()" onMouseOver="dothisfirst(this, 'Encrypt The HTML Code...')" onMouseOut="thendothis(this)"></td>
    </tr>
    <tr>
    <td width="100%" align="center"><input class="but" type="button" value="Place Encrypted HTML Code Onto The Clipboard" name="select" onClick="selectCode()" onMouseOver="dothisfirst(this, 'Select the encrypted code and copy it to the clipboard...')" onMouseOut="thendothis(this)"></td>
    </tr>
    <tr>
    <td width="100%" align="center"><input class="but" type="reset" value="Clear Box (Start Over)" name="clear" onMouseOver="dothisfirst(this, 'Clear the code from the box above!')" onMouseOut="thendothis(this)"></td>
    </tr>
    </table>
    </center>
    </div>
    </td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>
    </center>
    </html>
    Wonder

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    If you just wanted this utlity to be able to decrypt the stuff that it encrypted then you could just modify the encrypt function:

    Code:
    function degenerate(what){
    	code = document.pad.text;
    	if (code.value.length>0){
    		code.value=unescape(code.value.substring(code.value.indexOf("'")+1,code.value.lastIndexOf("'")));
    	}else if (code.value.length == ""){
    		alert('Hey PASTE the encrypted html before clicking that stuff');
    		document.pad.text.focus();
    	}
    }

  • #3
    mex
    mex is offline
    Regular Coder
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I replace your script with mine and IT DIDN'T WORK ANYMORE.... can u be please more specific with the script... thanx
    Wonder

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    The function I posted is not a replacement for any of the functions you had, it is an additional function based on the generate function. Put the function I wrote up into your script with all of the other functions. Then of course you will have to add a button to the the page which will call the degenerate function.

  • #5
    mex
    mex is offline
    Regular Coder
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    welll... thanx but can u let me know the Decrypt code button as the ones i tried are not working... I dont know why!!!!!

    Thanx anyway
    Wonder

  • #6
    Regular Coder
    Join Date
    Mar 2004
    Location
    Australia
    Posts
    217
    Thanks
    0
    Thanked 1 Time in 1 Post
    ok. remind you that he is mod so try be a lil more courteous next time. he has done you a favour and the code worked fine besides the forgotten {

    all you needed to do yourself was create your own button set the onclick to the function and its done.

    i done a quick job here. can easily be done better.

    Code:
    <html><script language="JavaScript"><!--
    
    i=0;
    s=0;
    num=0;
    seq1="",seq2="";
    
    ie = document.all?1:0;
    ns = document.layers?1:0;
    ns6 = document.getElementById?1:0;
    svet = "";
    
    function generate(what)
    {
    code = document.pad.text;
    if (code.value.length>0) code.value = "<script language=JavaScript>m='"+escape(code.value)+"';d=unescape(m);document.write(d);<\/script>";
    else if (code.value.length == "")
    {
    alert('Hey PASTE the html before clicking that stuff');
    document.pad.text.focus();
    }
    }
    
    function selectCode()
    {
    padText=document.pad.text;
    if(padText.value.length>0)
    {
    if (ie)
    {
    therange=padText.createTextRange();
    therange.execCommand("Copy");
    window.status="Encrypted HTML copied to Clipboard!";
    setTimeout("window.status=''",1800);
    }
    padText.focus();
    padText.select();
    }
    else alert('Please paste your HTML code into the box first...')
    }
    
    function degenerate(what)
    {
    	code = document.pad.text;
    	if (code.value.length>0)
    	{
    		code.value=unescape(code.value.substring(code.value.indexOf("'")+1,code.value.lastIndexOf("'")));
    	}
    	else if (code.value.length == "")
    	{
    		alert('Hey PASTE the encrypted html before clicking that stuff');
    		document.pad.text.focus();
    	}
    }
    
    function dothisfirst(what, message)
    {
    if (ie||ns6)
    {
    window.status=message;
    what.style.backgroundColor='#EAEAEA';
    what.style.cursor='hand';
    }
    else window.status=message;
    }
    function thendothis(what)
    {
    if (ie||ns6)
    {
    what.style.backgroundColor='white';
    window.status='';
    }
    else window.status='';
    }
    // --></script>
    </p><center>
    <table border="0" width="100%" cellspacing="0" cellpadding="5" style="border-collapse: collapse" bordercolor="#111111">
    <tr>
    <td valign="top" align="left">
    <center><font size="2" color="#008000" face="Arial"><i>
    <b>Paste original HTML in the box:</b></i></font></center>
    <form method="post" name="pad" align="center">
    <table border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
    <tr>
    <td width="425">
    <textarea nowrap class="box" rows="15" name="text" cols="77" wrap></textarea></td>
    </tr>
    <tr>
    <td width="425">
    <br>
    <div align="center">
    <center>
    <table border="0" width="100%" cellspacing="6" cellpadding="0">
    <tr>
    <td width="100%" align="center"><input class="but" type="button" value="Encrypt HTML" name="compileIt" onClick="generate()" onMouseOver="dothisfirst(this, 'Encrypt The HTML Code...')" onMouseOut="thendothis(this)"></td>
    </tr>
    <tr>
    <td width="100%" align="center"><input class="but" type="button" value="DeEncrypt HTML" name="DecompileIt" onClick="degenerate()" onMouseOver="dothisfirst(this, 'Encrypt The HTML Code...')" onMouseOut="thendothis(this)"></td>
    </tr>
    <tr>
    <td width="100%" align="center"><input class="but" type="button" value="Place Encrypted HTML Code Onto The Clipboard" name="select" onClick="selectCode()" onMouseOver="dothisfirst(this, 'Select the encrypted code and copy it to the clipboard...')" onMouseOut="thendothis(this)"></td>
    </tr>
    <tr>
    <td width="100%" align="center"><input class="but" type="reset" value="Clear Box (Start Over)" name="clear" onMouseOver="dothisfirst(this, 'Clear the code from the box above!')" onMouseOut="thendothis(this)"></td>
    </tr>
    </table>
    </center>
    </div>
    </td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>
    </center>
    </html>

    you could also indent some of the code to make it cleaner and easier to read

  • #7
    mex
    mex is offline
    Regular Coder
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well I'm sorry if i have hurt anyone around here. anyway thanx so much for the help... though there's some error & not working in the script, I'll try to figure it out...

    thanx again
    Wonder


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •