Ejemplo n.º 1
0
 public function testEncryptDecryptChars()
 {
     $secret = '$%ÄüfuDFRR';
     $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
     $this->assertEquals(
         $string,
         HordeCipherBlowfishOperations::blowfishDecrypt(
             HordeCipherBlowfishOperations::blowfishEncrypt($string, $secret),
             $secret
         )
     );
 }
 /**
  * Encryption using blowfish algorithm (mcrypt)
  *
  * @param string $data   original data
  * @param string $secret the secret
  *
  * @return string the encrypted result
  */
 public function blowfishEncrypt($data, $secret)
 {
     global $iv;
     if (!function_exists('mcrypt_encrypt')) {
         include_once "HordeCipherBlowfishOperations.class.php";
         return HordeCipherBlowfishOperations::blowfishEncrypt($data, $secret);
     }
     return base64_encode(mcrypt_encrypt(MCRYPT_BLOWFISH, $secret, $data, MCRYPT_MODE_CBC, $iv));
 }