I have a PHP function that uses mcrypt. The problem is that PHP 7.2 does not accept mcrypt anymore ... Does anyone know how to redo it so as to get the same result using Openssl?
function Encript($Val, $chave){
$cifrado = MCRYPT_RIJNDAEL_256;
$modo = MCRYPT_MODE_ECB;
$Cript = mcrypt_encrypt($cifrado, $chave, $Val, $modo, mcrypt_create_iv(mcrypt_get_iv_size($cifrado, $modo), MCRYPT_DEV_RANDOM));
return base64_encode($Cript);
}
function Decript($Val, $chave){
$Base = base64_decode($Val);
$cifrado = MCRYPT_RIJNDAEL_256;
$modo = MCRYPT_MODE_ECB;
return mcrypt_decrypt($cifrado, $chave, $Base, $modo, mcrypt_create_iv(mcrypt_get_iv_size($cifrado, $modo), MCRYPT_DEV_RANDOM));
}