Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 07-06-2005, 12:11 AM Encoder Edit
stickycarrots's Avatar
Experienced Talker

Posts: 48
Name: Luke
Location: Illinois State University
Trades: 0
I want this encoder script to split up the characters so it's not one big long strand of code. It doesn't matter really how it splits it up.

I know there has to be a way to edit the code so it'll split it up and I've been trying to figure it out, but I just can't.

Your help is great appreciated.

Here's the script that needs edited:
Code:
<script language="JavaScript">

//Message Encrypter- By Naresh Hotchandani (nhotchandani@rediffmail.com)
//Script featured on Dynamic Drive
//Visit http://www.dynamicdrive.com for this script and more 

len=0;

function CalcKey()
{
len=0;
var temp=document.Encrypt.Key.value;

for(i=0;i<temp.length;i++)
{
len=len+temp.charCodeAt(i);
}
if(len==0)
{
alert('Please Enter the appropriate Key');
document.Encrypt.Key.focus();
}
return len;
}


function Encryption()
{

CalcKey();
document.Encrypt.Encrypted.value="";
var txt=document.Encrypt.normal.value;

var net="";
var fin=0;

if(len>0)
{

if(txt.length>0)
{
for(i=0;i<txt.length;i++)
{
fin=txt.charCodeAt(i)+len;

if(fin>99)
{
net=net+fin;
}
else
{
net=net+'0'+fin;
}
}

document.Encrypt.Encrypted.value=net;
document.Encrypt.normal.value="";
}
else
{
alert('Please Enter the Text to be Encrypted');
document.Encrypt.normal.focus();
}

}
}

function Decryption()
{
var txt=document.Encrypt.Encrypted.value;
var j=3;
var temp1;
var res="";

CalcKey();

if(len>0)
{
if(txt.length>0)
{
for(i=0;i<txt.length;i+=3)
{

var temp=txt.substring(i,j);
temp1=(parseInt(temp)-len);
var t=unescape('%'+temp1.toString(16));
if(t=='%d' || t=='%a')
{
res=res+' ';
}
else
{
res=res+t
} 
j+=3;
}
document.Encrypt.normal.value=res;
document.Encrypt.Encrypted.value="";
}
else
{
alert('Please Enter the Encrypted Text');
document.Encrypt.Encrypted.focus();
}
}
}

</script>
Thanks again,
stickycarrots
__________________
I am an
Please login or register to view this content. Registration is FREE
at
Please login or register to view this content. Registration is FREE

-
Please login or register to view this content. Registration is FREE

-
Please login or register to view this content. Registration is FREE

Last edited by stickycarrots; 07-06-2005 at 12:15 AM..
stickycarrots is offline
Reply With Quote
View Public Profile Visit stickycarrots's homepage!
 
 
Register now for full access!
Old 07-06-2005, 05:35 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
use a loop and the string.slice method to split it up.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-06-2005, 01:32 PM
stickycarrots's Avatar
Experienced Talker

Posts: 48
Name: Luke
Location: Illinois State University
Trades: 0
How do you apply that to the script so that it works?
__________________
I am an
Please login or register to view this content. Registration is FREE
at
Please login or register to view this content. Registration is FREE

-
Please login or register to view this content. Registration is FREE

-
Please login or register to view this content. Registration is FREE
stickycarrots is offline
Reply With Quote
View Public Profile Visit stickycarrots's homepage!
 
Reply     « Reply to Encoder Edit
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11752 seconds with 12 queries