Jump to content

Blowfish


RobertP

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.