[PHP] [php] openssl encrypt/decrypt(AES-256-ECB)

하나를하더라도최선을
2022-08-09 19:10
665
0
본문
<?
$iv = '8746376827619797';
$key = "40ea168bdf014de783fb9a6640448bff";
function encrypt($original_string, $crypt_key, $crypt_iv) {
$option = 0;
$cipher_algo = "AES-256-ECB";
return openssl_encrypt($original_string, $cipher_algo, $crypt_key, $option, $crypt_iv);
}
function decrypt($encrypted_string, $crypt_key, $crypt_iv) {
$option = 0;
$cipher_algo = "AES-256-ECB";
$decrypted_string = openssl_decrypt ($encrypted_string, $cipher_algo, $crypt_key, $option, $crypt_iv);
return substr($decrypted_string,16);
}
?>
댓글목록0