RobertP Posted September 22, 2012 Share Posted September 22, 2012 (edited) Is this a realistic approach? (this is not my code, just my structure) <?php class blowfish { private $key; private $iv; public function __construct($key,$iv){ $this->key = $key; $this->iv = $iv; } public function encrypt($data){ return mcrypt_encrypt(MCRYPT_BLOWFISH,$this->key,$data,MCRYPT_MODE_CBC,$this->iv); } public function decrypt($data){ return mcrypt_decrypt(MCRYPT_BLOWFISH,$this->key,$data,MCRYPT_MODE_CBC,$this->iv); } } ?> $blowfish = new blowfish('bnwoiueewoencwqoegnqoe','18282818'); $data = $blowfish->encrypt('testString'); echo $blowfish->decrypt($data); //Output: testString Edited September 22, 2012 by RobertP Quote Link to comment https://forums.phpfreaks.com/topic/268671-blowfish/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.