/    Sign up×
Community /Pin to ProfileBookmark

Here is a small script which can encrypt but cannot [B]decrypt[/B] !!! Can anyone help me out with the decrypt-script as well as for the button!

thanx


——————————

<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>
——————————-

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryJul 14.2004 — Calling it encryption is a bit much really; I hope you aren't going to use this for anything vaguely serious. To decrypt, you can just do this (where s is the value in the textarea):

s = unescape(s).substr(31, unescape(s).length - 74);

Adam
Copy linkTweet thisAlerts:
@mexauthorJul 19.2004 — I'm not a javascript programmer and so i'm a bit confused with your post!!!! Can u please re-write the script for me so that i can just copy and paste without having to do anything.... thank you.
Copy linkTweet thisAlerts:
@PittimannJul 19.2004 — Hi!

Just add another function to your js with the code, AdamGundry provided:

function decrypt(){

code = document.pad.text;

code.value=unescape(code.value).substr(31, unescape(code.value).length - 74)

}

Then add a button to your form with onclick="decrypt()". When this button is clicked and the textarea contains "encrypted" text, this will be "decrypted".

Cheers - Pit
Copy linkTweet thisAlerts:
@mexauthorJul 20.2004 — can u pliz do that for me, Pittimann. I tried putting them but nothing work for the decrypt!!! I hope i'm not troubling you. thanx for the reply
×

Success!

Help @mex spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...