My friend gave me a piece of encoded PHP code. I decoded it and I got this:
function rotencode($string,$amount) { $key = substr($string, 0, 1); if(strlen($string)==1) { return chr(ord($key) + $amount); } else { return chr(ord($key) + $amount) . rotEncode(substr($string, 1, strlen($string)-1), $amount); }}
He said I am supposed to find a variable and a code like this:
$variablename = 123324234;
Any ideas?
Decoding this piece of PHP code!
Started by master131, Apr 04 2010 05:53 PM
5 replies to this topic
#1
Posted 04 April 2010 - 05:53 PM
|
|
|
#2
Posted 04 April 2010 - 07:13 PM
#3
Posted 07 April 2010 - 06:58 AM
LOL
#4
Posted 09 April 2010 - 12:31 AM
function rotencode($string,$amount)
{
$key = substr($string, 0, 1);
if(strlen($string)==1)
{
return chr(ord($key) + $amount);
}
else
{
return chr(ord($key) + $amount) . rotEncode(substr($string, 1, strlen($string)-1), $amount);
}
}
i dont get it at all XD
#5
Posted 11 April 2010 - 06:27 AM
What it does is that it adds $amount to all character values in the string, and it does it recursively.
so if you call:
rotEncode("12345", 3), it will return "45678"
rotEncode("ABCDE", 5), it will return "FGHIJ"
so if you call:
rotEncode("12345", 3), it will return "45678"
rotEncode("ABCDE", 5), it will return "FGHIJ"
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#6
Posted 14 April 2010 - 01:18 AM


Sign In
Create Account

Back to top









