Display the drop-down list

openssl_encrypt()

« openssl_digest | openssl_error_string »
<?php
$string 
openssl_encrypt (
    
// string $data
    
?// string $method
    
// string $password
    
?// [int $options = 0]
    
  // [string $iv = ""]
);

// shows the result in base64 and decrypted
if ($options OPENSSL_RAW_DATA) {
    
$base64 base64_encode($string);
}
$decrypted openssl_decrypt($string$method$password$options$iv);
?>
Result
$string = 'eXIp3BnsELdTuTvVkpoFqXuYoP6zd73ETDXiNcMhXUiuAm0ju4ufdX9Yxai4X7S3'
$decrypted = 'This string was AES-128 / ECB encrypted.'
Examples
#1 openssl_encrypt  ("This string was AES-128 / ECB encrypted.",
 
"AES-128-ECB",
 
"some password")
#2 openssl_encrypt  ("This string was AES-128 / CBC encrypted.",
 
"AES-128-CBC",
 
"some password",
 
OPENSSL_RAW_DATA,
 
"some 16 byte iv.")
See also
base64_encode, openssl_decrypt