I have this php script (encrypt.php)
<?php
function encrypt($pure_string, $encryption_key, $encryptionMethod = "AES-256-CBC")
{
$iv = "3571984260";
$encrypted_string = openssl_encrypt($pure_string, $encryptionMethod, $encryption_key, false, $iv);
return $encrypted_string;
}
echo encrypt ("$argv[1]", 'mysecret');
?>
It works, but I am trying to reach the same result via openssl cli (I need it).
But this:
echo '12345' | openssl enc -aes-256-cbc -iv "3571984260" -k mysecret -a
Does not produce the same results as:
php encrypt.php 12345
Actually the shell version is changing the generated string for each execution, and the php version is generating the same always. I need to obtain the same results as the php script using openssl cli.
What am I doing wrong?