Decryption function in PHP returning a value of 1 (What am I doing wrong?)
This is the method
public function _PRZ_decrypt_data($_salt, $_input)
{
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $_salt, $_input, MCRYPT_MODE_ECB, $this->_PRZ_get_iv()));
}
I am calling it as one of my parameters as follows
$this->开发者_高级运维_PRZ_decrypt_data($salt, base64_decode($code))
It seems to be returning a 1 when a properly endoded value is decoded via the function.
Break the function calls into a single action per line, and output the inputs, and result of each step. Make sure that you are passing appropriate values in, and get sensible outputs. As the saying goes - GIGO. That will tell you where the bad data is coming from. Guessing does not.
Then, look at the manual page on mcrypt_decrypt()
to see examples of use.
精彩评论