BIG
$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
LIST
'!!...PHP > !!...CI4' 카테고리의 다른 글
CodeIgniter 4.x _011_ writable 디렉토리 심볼릭 링크 설정 (0) | 2024.05.12 |
---|---|
CodeIgniter 4.x _010_Model 파일 내부에서 직접 DB 접속 정보 설정 (0) | 2024.05.06 |
CodeIgniter 4.x _008_Database.php sample (0) | 2023.01.09 |
CodeIgniter 4.x _007_URL helper Sample (0) | 2022.11.10 |
CodeIgniter 4.x _006_Cookie 설정 (0) | 2022.11.07 |