본문 바로가기
개발자 커뮤니티에 오신 것을 환영합니다!

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

페이지 정보

profile_image
작성자 하나를하더라도최선을
댓글 0건 조회 11,134회 작성일 22-08-09 19:10

본문

<?
 
    $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);
    }
 
?>
 

댓글목록

등록된 댓글이 없습니다.


Copyright © program1472 | IT HUB. All rights reserved.