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 -aDoes not produce the same results as:php encrypt.php 12345Actually 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? 
How to make openssl encrypt passwords like php via command line
openssl
I discovered it !The php uses iv and key variables as strings, and the openssl CLI needs the hexadecimal version of the strings, without spaces and new line as I will show. First I need to convert the iv and the pass strings to hexadecimal using:Determine the IV hexadecimal equivalent:hexiv=$(echo $(echo -n '3571984260' | od -A n -t x1) | tr -d  )Determine the mysecret hexadecimal equivalent:hexpass=$(echo $(echo -n 'mysecret' | od -A n -t x1) | tr -d  )Now one more thing the pass for php is not the pass for openssl cli but the KEY:echo -n '12345' | openssl enc -aes-256-cbc -iv $hexiv -K $hexpass -aAnd now it is working exactly like the php script! Important: I needed to use -K in uppercase or the generated string is not the same. 