mcrypt_encrypt deprecated, find the exact alternative output [duplicate] - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, April 2, 2022

mcrypt_encrypt deprecated, find the exact alternative output [duplicate]

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