Hello all,
I have a slight problem with my coding on a login script. The login script basically encrypts the users username, password and ID in a cookie with this function:
function encrypt($text){
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}
and then when I try to retrieve the same value after setting with this function:
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)));
}
It first gives me this output:
t¨‘žÃŽ^kè¦Ü=yà¸ìŸ2Œ£· _¢Ó
But when I refresh the page, it gives me the correct output that I wanted.
From the looks of it, it looks like it's compressed. I cannot find anything on google about it and I feel lost as to what to do. Help me plz