I've got a very simple function:
$me = 45S237s53dsSerwjw53s23rjf; //Some long encrypted string.
function decrypt($user){
$user = pack("H*" , $user); //Converting from hexadecimal to binary
$user = mcrypt_ecb(MCRYPT_DES, $key, $user, MCRYPT_DECRYPT); //Decrypting
return $user;
}
The problem is if I do go echo decrypt($me);
it doesn't work, I don't end up with a decrypted string.
However if I do essentially the same thing without using a function
it works:
$user = $me;
$user = pack("H*" , $user);
$user = mcrypt_ecb(MCRYPT_DES, $key, $user, MCRYPT_DECRYPT);
echo $user; //Works fine...
What's going on here?