티스토리 뷰
웹프로그래밍/PHP
[PHP 7.2] mcrypt_create_iv, mcrypt_encrypt, mcrypt_decrypt is undefined function
jihun202 2018. 8. 28. 14:13반응형
mcrypt_* 이 PHP 7.1 에서 deprecated 이 되었고, PHP7.2 에서 mcrypt_* 이 삭제되어 사용이 불가능 해졌다.
대신 openssl encrypt 를 사용하면 된다.
private static $key = "key_pass";
private static $cipher = "aes-256-cbc";
public static function encrypt($buffer){
$ivlen = openssl_cipher_iv_length(self::$cipher);
$iv = openssl_random_pseudo_bytes($ivlen);
return openssl_encrypt($buffer, self::$cipher, self::$key, $options=0, $iv, $tag);
}
public static function decrypt($buffer){
$ivlen = openssl_cipher_iv_length(self::$cipher);
$iv = openssl_random_pseudo_bytes($ivlen);
return openssl_decrypt($buffer, self::$cipher, self::$key, $options=0, $iv, $tag);
}
반응형
'웹프로그래밍 > PHP' 카테고리의 다른 글
| XE Uncaught Error: Class 'Object' not found in (0) | 2022.07.06 |
|---|---|
| [PHP] phpMyAdmin blowfish_secret 경고 해결법 (2) | 2022.05.04 |
| php : Thread Safe 와 Non Thread Safe 차이점 (0) | 2017.12.02 |
| PHP: Simple compression of JSON data (0) | 2016.06.16 |
| How to call PHP function from string stored in a Variable (0) | 2016.05.24 |
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 정부
- 안드로이드
- 금융
- 연말정산
- 부동산
- 고금리
- 적금
- 내집마련
- 해외주식
- ubuntu
- 카뱅
- 앱테크
- 투자
- 우회
- 아파트매매
- etf
- 2026
- 대출
- 안과
- 공제
- 출산
- 카카오뱅크
- 신혼부부
- 주담대
- remove
- 지도
- 혜택
- 재테크
- 세금
- php
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
글 보관함