Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 04:31 AM.


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