Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

?php // warning! ugly code ahead :) // requires php5.x, sorry for that funct..

Decoded Output download

<?  ?php 
 
	// warning! ugly code ahead :) 
	// requires php5.x, sorry for that 
  		 
	function encrypt($str) 
	{ 
		$cryptedstr = ""; 
		srand(3284724); 
		for ($i =0; $i < strlen($str); $i++) 
		{ 
			$temp = ord(substr($str,$i,1)) ^ rand(0, 255); 
			 
			while(strlen($temp)<3) 
			{ 
				$temp = "0".$temp; 
			} 
			$cryptedstr .= $temp. ""; 
		} 
		return base64_encode($cryptedstr); 
	} 
   
	function decrypt ($str) 
	{ 
		srand(3284724); 
		if(preg_match('%^[a-zA-Z0-9/+]*={0,2}$%',$str)) 
		{ 
			$str = base64_decode($str); 
			if ($str != "" && $str != null && $str != false) 
			{ 
				$decStr = ""; 
				 
				for ($i=0; $i < strlen($str); $i+=3) 
				{ 
					$array[$i/3] = substr($str,$i,3); 
				} 
 
				foreach($array as $s) 
				{ 
					$a = $s ^ rand(0, 255); 
					$decStr .= chr($a); 
				} 
				 
				return $decStr; 
			} 
			return false; 
		} 
		return false; 
	} 
? ?>

Did this file decode correctly?

Original Code

?php

	// warning! ugly code ahead :)
	// requires php5.x, sorry for that
  		
	function encrypt($str)
	{
		$cryptedstr = "";
		srand(3284724);
		for ($i =0; $i < strlen($str); $i++)
		{
			$temp = ord(substr($str,$i,1)) ^ rand(0, 255);
			
			while(strlen($temp)<3)
			{
				$temp = "0".$temp;
			}
			$cryptedstr .= $temp. "";
		}
		return base64_encode($cryptedstr);
	}
  
	function decrypt ($str)
	{
		srand(3284724);
		if(preg_match('%^[a-zA-Z0-9/+]*={0,2}$%',$str))
		{
			$str = base64_decode($str);
			if ($str != "" && $str != null && $str != false)
			{
				$decStr = "";
				
				for ($i=0; $i < strlen($str); $i+=3)
				{
					$array[$i/3] = substr($str,$i,3);
				}

				foreach($array as $s)
				{
					$a = $s ^ rand(0, 255);
					$decStr .= chr($a);
				}
				
				return $decStr;
			}
			return false;
		}
		return false;
	}
?

Function Calls

None

Variables

None

Stats

MD5 42c5f961144b117f646ff4ba9c51b9ac
Eval Count 0
Decode Time 48 ms