Since mcrypt_encrypt no mre exist in latest php, i need to convert this function to something new, maybe openssl ???
The result must be exactly the same with the new function but i can't get it:
function encrypt($key, $data, $iv)
{
$padding = 16 - (strlen($data) % 16);
$data .= str_repeat(chr($padding), $padding);
return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, $iv);
}
source https://stackoverflow.com/questions/71708830/mcrypt-encrypt-deprecated-find-the-exact-alternative-output
No comments:
Post a Comment