On Wed, Nov 30, 2011 at 10:57 PM, Rick Dwyer <rpdw...@earthlink.net> wrote:
> My decrypt is below:
>
> $myval=$_GET["myval"];
>
>
> // let the encryption begin
>
> define('SALT', 'myvalueforsalthere');
>
> function decrypt($text)
> {
>    return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT,
> base64_decode($text), MCRYPT_MODE_ECB,
> mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
> MCRYPT_RAND)));
> }
>
> echo decrypt($myval);
>
>

Your decrypt function seems fine, and the encrypt/decrypt functions
work fine both in the same file for me. Now you say you use
$_GET["myval"], which means you get them from URL. Base64 is not URL
safe, have you used urlencode()?

Matijn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to