Welcome Guest [Log In] [Register]



Add Reply
Encryption; "simple but effective"
Topic Started: Jul 20 2006, 09:30 PM (578 Views)
ari_aaron
Member Avatar
1a4
Root Administrator
This is my encryption script, which works very well, especialy considering that it is only 15 lines (including comment ans spaces). I am not even going to bother posting it on the GMC, because there are so many of them.

Encrypt:
Code:
 

//arg0: string to encrypt

len=string_length(argument0)

for(i=1;i!=len+1;i+=1)
{
letter[i]=string_char_at(argument0,i)
letter[i]=chr(ord(letter[i])+(i*2))
}
str=''
for(a=1;a!=len+1;a+=1)
{
str+=letter[a]
}
return str


Decrypt (change 1 char + comment :P):
Code:
 

//arg0: string to decrypt

len=string_length(argument0)

for(i=1;i!=len+1;i+=1)
{
letter[i]=string_char_at(argument0,i)
letter[i]=chr(ord(letter[i])-(i*2))
}
str=''
for(a=1;a!=len+1;a+=1)
{
str+=letter[a]
}
return str


Notice how it will be diffrent depending on the position, so you can't match that @=n or something like that.

What do you all think?

My msn: Posted Image
Posted Image
If anyone wants GMail or Windows Live Messenger invites, PM me!
Offline Profile Quote Post Goto Top
 
ChIkEn


I see you suck at for loops.
Don't. Ever. Edit. My. Signature.

You will pay if you do it again.
Offline Profile Quote Post Goto Top
 
ari_aaron
Member Avatar
1a4
Root Administrator
why?

My msn: Posted Image
Posted Image
If anyone wants GMail or Windows Live Messenger invites, PM me!
Offline Profile Quote Post Goto Top
 
rig
1a5a6a4
Administrators
Decrypt This:

Vlo{*u0s4xy@NdnŽĿzۊה

Hmm... I almost have an idea... a secret messaging system the admins can use so only they can understand it.

Code:
 

readstr=get_string("Some string: ","");
fileid=file_text_open_write("textmessage.txt");
file_text_writeln(fileid);
file_text_write_string(fileid,encrypt(readstr));
file_text_close(fileid);


Quote:
 
I see you suck at for loops.

Couldn't you put the str+=letter[a]
at the end of the first for loop instead of adding an extra for loop?
Posted Image
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Extending Game Maker: DLLs, Scripts, and Libraries · Next Topic »
Add Reply


Theme designed by Sith of Outline