RobertP Posted September 22, 2012 Share Posted September 22, 2012 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 Link to comment https://forums.phpfreaks.com/topic/268671-blowfish/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.