Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-02-2008, 07:50 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
encrypt function

This is a little encrypt function I made, attached below

encrypt.txt

Now, there are 3 arguments, encrypt(string, key, buffer);

String can be anything from "foo" to "Hi there, I'm Chompy and this text is going to be encrypted".

Key is just an extra factor to the encryption, it can be whatever you want it to be

Buffer, this is the length of the string that you will get in return, can be any length, from 1 to 100 or more

Remember, the longer the arguments are, the longer it takes to encrypt, logical


anyways, some examples:

PHP Code:
function onCreated() {
  echo(
encrypt("foo""bar"8)); // FrvUqQuU
  
echo(encrypt("Hi there, I'm Chompy""key"8)); // lCAP4FFy
  
echo(encrypt("Hi there, I'm Chompy""key"6)); // YkI6IL
  
echo(encrypt("wee, I'm being encrypted!""yep"16)); // b845MaTRcmOG4EjC
  
echo(encrypt("baz""bar"24)); // 3hBPVspQmuKQ1PrAvuG4FmdL
  
echo(encrypt("foo""foo"10)); // 4KjCpuokgC

How effective it is,.. I don't know how to measure that, but it does the job.

If you find any bugs and such, feel free to post them :o
__________________
Reply With Quote
  #2  
Old 05-02-2008, 08:55 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Oooh nice, looks like it was fun to make
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 05-02-2008, 07:39 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
how to decode?
Reply With Quote
  #4  
Old 05-02-2008, 07:42 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by [email protected] View Post
how to decode?
Doesn't look like you can, but I don't think you need to decode encrypted things all the time.
__________________
Reply With Quote
  #5  
Old 05-02-2008, 07:48 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
he didn't post one, i don't see a point in encoding things anyway, most people wouldn't even know how to decode an md5 hash tbh, well in Graal anyway
Reply With Quote
  #6  
Old 05-02-2008, 07:58 PM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by [email protected] View Post
he didn't post one, i don't see a point in encoding things anyway, most people wouldn't even know how to decode an md5 hash tbh, well in Graal anyway
MD5 is a one-way hash. It can't be decoded.
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #7  
Old 05-02-2008, 07:59 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
http://www.md5decrypter.com/
Reply With Quote
  #8  
Old 05-02-2008, 08:04 PM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by [email protected] View Post
They store a database of all words and phrases encrypted through the website. For example, try to decrypt this:

d38cbe1816dd0c9919ebfba20f654fca

Literal text:
"This is a test to see if MD5 decrypter can actually decrypt MD5..."

You'll see that it won't work.
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #9  
Old 05-02-2008, 08:08 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
who would use that as a password?

i see your point though
Reply With Quote
  #10  
Old 05-02-2008, 08:11 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by [email protected] View Post
who would use that as a password?

i see your point though
Dude, the string he posted is an MD5 hash of some text, not actual text.

What his point is that the only way that website works is by trying things they've already stored in their database. No "decryption" (even though encryption/decryption is the wrong word for MD5 hashing) is taking place.
Reply With Quote
  #11  
Old 05-02-2008, 09:05 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
You measure encryption effectiveness in (at least) two ways:
1. Is it feasible to easily determine two (or more) strings producing the same encrypted string?
2. Is it likely that two similar strings produce similar encrypted strings?

Yours passes both. Well done.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #12  
Old 05-02-2008, 09:16 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Is there ever a need to decode? When I was learning PHP I remember reading about encrypting and such and you never need to decode an encryption, simply taking inputted text and encrypting it and comparing it to the already encrypted text.
Reply With Quote
  #13  
Old 05-02-2008, 09:19 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by DustyPorViva View Post
Is there ever a need to decode?
Yes, sometimes it is useful for securely transferring data, e.g., SSH.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #14  
Old 05-02-2008, 10:06 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Oh, I get it coool he he
Reply With Quote
Reply


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

Forum Jump


All times are GMT +2. The time now is 01:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.