$plainText  =   'This is a plain-text message!';        //  암호화 대상 문자열

$config         = new \Config\Encryption();
$config->key    = 'abcdefghijklmnopqrstuvwxyz012345';   //  32 자리 문자열
$config->driver = 'OpenSSL';
$config->digest = 'SHA512';
$config->cipher = 'AES-256-CTR';

$encryption     =   new \CodeIgniter\Encryption\Encryption();
$encrypter      =   $encryption->initialize($config);
$encrypt_text   =   $encrypter->encrypt( $plainText );

echo $encrypt_text."\n";

$base64_encoded_text   =   base64_encode( $encrypt_text );

echo $base64_encoded_text."\n";

$base64_decoded_text   =   base64_decode( $base64_encoded_text );

echo $base64_decoded_text."\n";

$decrypt_text = $encrypter->decrypt( $base64_decoded_text );

echo $decrypt_text."\n";

CodeIgniter 4.x _009_AES-256 encrypt sample code