Display the drop-down list

mcrypt_decrypt()

« mcrypt_create_iv | mcrypt_encrypt »
<?php
// enter a string to encrypt ($e_data),
// or a string encrypted in base64 ($base64) or binary ($data)

$encrypted mcrypt_encrypt(
    
?// string $e_cipher
    
// string $e_key
    
// string $e_data
    
?// string $e_mode
    
 // [string $e_iv]
);

$base64 base64_encode($encrypted);

$data base64_decode(
    
  // string $base64
);

$string mcrypt_decrypt (
    
?// string $cipher
    
// string $key
    
// string $data
    
?// string $mode
    
  // [string $iv]
);
?>
Result
$base64 = 'syHfih5StSSmrudWgA/0VANHjwYo/GOCjIFGcjOpQB170MEsRltllzHtUz+kodcUPWOlzjU5MW+wW2cudQKiYw=='
$data = 'syHfih5StSSmrudWgA/0VANHjwYo/GOCjIFGcjOpQB170MEsRltllzHtUz+kodcUPWOlzjU5MW+wW2cudQKiYw=='
$string = 'This string was AES-128 / CBC / ZeroBytePadding encrypted.' "\0" '' "\0" '' "\0" '' "\0" '' "\0" '' "\0" ''
Error : Function mcrypt_encrypt() is deprecated
Error : Function mcrypt_decrypt() is deprecated
Examples
#1 mcrypt_decrypt  (MCRYPT_RIJNDAEL_128,
 
"some 16 byte key",
 
"\xb3\x21\xdf\x8a\x1e\x52\xb5\x24\xa6\xae\xe7\x56\x80\x0f\xf4\x54\x03\x47\x8f\x06\x28\xfc\x63\x82\x8c\x81\x46\x72\x33\xa9\x40\x1d\x7b\xd0\xc1\x2c\x46\x5b\x65\x97\x31\xed\x53\x3f\xa4\xa1\xd7\x14\x3d\x63\xa5\xce\x35\x39\x31\x6f\xb0\x5b\x67\x2e\x75\x02\xa2\x63",
 
MCRYPT_MODE_CBC,
 
"some 16 byte iv.")
#2 mcrypt_decrypt  (/* $base64 = "syHfih5StSSmrudWgA/0VANHjwYo/GOCjIFGcjOpQB170MEsRltllzHtUz+kodcUPWOlzjU5MW+wW2cudQKiYw==" */
 
MCRYPT_RIJNDAEL_128,
 
"some 16 byte key",
 
$data,
 
MCRYPT_MODE_CBC,
 
"some 16 byte iv.")
#3 mcrypt_decrypt  (/* $e_cipher = MCRYPT_RIJNDAEL_128 */
 /* $e_key = "some 16 byte key" */
 /* $e_data = "This string was AES-128 / CBC / ZeroBytePadding encrypted." */
 /* $e_mode = MCRYPT_MODE_CBC */
 /* $e_iv = "some 16 byte iv." */
 /* $base64 = $base64 */
 
MCRYPT_RIJNDAEL_128,
 
"some 16 byte key",
 
$data,
 
MCRYPT_MODE_CBC,
 
"some 16 byte iv.")
See also
base64_decode, base64_encode, mcrypt_encrypt