Display the drop-down list

openssl_decrypt()

« openssl_cipher_iv_length | openssl_digest »
<?php
// enter a string to encrypt ($e_data) or the string encrypted ($data)

$data openssl_encrypt(
    
// string $e_data
    
?// string $e_method
    
// string $e_password
    
?// [int $e_options]
    
 // [string $e_iv]
);

$string openssl_decrypt (
    
// string $data
    
?// string $method
    
// string $password
    
?// [int $options = 0]
    
  // [string $iv = ""]
);

// shows the data in base64
if ($e_options OPENSSL_RAW_DATA) {
    
$base64 base64_encode($data);
}
?>
Result
$string = 'This string was AES-128 / ECB encrypted.'
Examples
#1 openssl_decrypt  ("eXIp3BnsELdTuTvVkpoFqXuYoP6zd73ETDXiNcMhXUiuAm0ju4ufdX9Yxai4X7S3",
 
"AES-128-ECB",
 
"some password")
#2 openssl_decrypt  ("\x79\x72\x29\xdc\x19\xec\x10\xb7\x53\xb9\x3b\xd5\x92\x9a\x05\xa9\x7b\x98\xa0\xfe\xb3\x77\xbd\xc4\x4c\x35\xe2\x35\xc3\x21\x5d\x48\xae\x02\x6d\x23\xbb\x8b\x9f\x75\x7f\x58\xc5\xa8\xb8\x5f\xb4\xb7",
 
"AES-128-ECB",
 
"some password",
 
OPENSSL_RAW_DATA)
#3 openssl_decrypt  (/* $e_data = "This string was AES-128 / ECB encrypted." */
 /* $e_method = "AES-128-ECB" */
 /* $e_password = "some password" */
 
$data,
 
"AES-128-ECB",
 
"some password")
#4 openssl_decrypt  (/* $e_data = "This string was AES-128 / ECB encrypted." */
 /* $e_method = "AES-128-ECB" */
 /* $e_password = "some password" */
 /* $e_options = OPENSSL_RAW_DATA */
 
$data,
 
"AES-128-ECB",
 
"some password",
 
OPENSSL_RAW_DATA)
See also
base64_encode, openssl_encrypt