Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   encrypt function (https://forums.graalonline.com/forums/showthread.php?t=79594)

Chompy 05-02-2008 07:50 AM

encrypt function
 
1 Attachment(s)
This is a little encrypt function I made, attached below

Attachment 44536

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 :p


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

Tigairius 05-02-2008 08:55 AM

Oooh nice, looks like it was fun to make :p

[email protected] 05-02-2008 07:39 PM

how to decode?

Crow 05-02-2008 07:42 PM

Quote:

Originally Posted by [email protected] (Post 1388671)
how to decode?

Doesn't look like you can, but I don't think you need to decode encrypted things all the time.

[email protected] 05-02-2008 07:48 PM

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

Programmer 05-02-2008 07:58 PM

Quote:

Originally Posted by [email protected] (Post 1388674)
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.

[email protected] 05-02-2008 07:59 PM

http://www.md5decrypter.com/

Programmer 05-02-2008 08:04 PM

Quote:

Originally Posted by [email protected] (Post 1388677)

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.

[email protected] 05-02-2008 08:08 PM

who would use that as a password?

i see your point though

Skyld 05-02-2008 08:11 PM

Quote:

Originally Posted by [email protected] (Post 1388680)
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.

Tolnaftate2004 05-02-2008 09:05 PM

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.

DustyPorViva 05-02-2008 09:16 PM

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.

Tolnaftate2004 05-02-2008 09:19 PM

Quote:

Originally Posted by DustyPorViva (Post 1388687)
Is there ever a need to decode?

Yes, sometimes it is useful for securely transferring data, e.g., SSH.

[email protected] 05-02-2008 10:06 PM

Oh, I get it coool he he


All times are GMT +2. The time now is 06:29 AM.

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