PHP - Blowfish/ECB/NoPadding

blowfish.php

<?php
   define(BLOW_REQ_KEY, "전송할때 필요한 키값"); 
   define(BLOW_RES_KEY, "받았을때 필요한 키값");

    function encode_blow($text) {
        
        $result = mcrypt_encrypt(MCRYPT_BLOWFISH, BLOW_REQ_KEY, $text, MCRYPT_MODE_ECB);
        $result = base64_encode($result);

        return $result;

    }

    function decode_blow($text) {
        
        $result = base64_decode($text);       
        $result = mcrypt_decrypt(MCRYPT_BLOWFISH, BLOW_RES_KEY, $result, MCRYPT_MODE_ECB);
        return $result;

    }

?>

 

오늘은 프로젝트를 진행하면서 Blowfish/ECB/NoPadding 암호화 작업이 필요했는데

 

PHP에서 뭘 어떻게 써야 Blowfish/ECB/NoPadding 를 이용하여 암호화를 하는지

 

여기저기 찾아보다가 ㅠㅠ 감격스럽게 찾아서 소스를 공유하겠습니다.

 

 

 

 

'Dev > PHP' 카테고리의 다른 글

그누보드 공부하기 - 경로 설명  (0) 2020.09.07
와이드샷 - 문자보내기 PHP  (0) 2020.09.03
PHP 내 아이피만 보기  (0) 2020.06.02
PHP curl 이용하기  (0) 2020.06.01
Codeigniter 4 Controller example  (0) 2020.04.06