Автор: Matthew Fonda (mfonda@php.net)
Автор: Philippe Jausions (jausions@php.net)
Автор: Michael Slusarz (slusarz@horde.org)
Наследование: extends Horde_Crypt_Blowfish_Base
Пример #1
0
 /**
  * @dataProvider vectorProvider
  */
 public function testMcryptDriver($vector)
 {
     if (!Horde_Crypt_Blowfish_Mcrypt::supported()) {
         $this->markTestSkipped();
     }
     $this->_doTest($vector, Horde_Crypt_Blowfish::IGNORE_OPENSSL);
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param string $key  Encryption key.
  * @param array $opts  Additional options:
  *   - cipher: (string) Either 'ecb' or 'cbc'.
  *   - ignore: (integer) A mask of drivers to ignore (IGNORE_* constants).
  *   - iv: (string) IV to use.
  */
 public function __construct($key, array $opts = array())
 {
     $opts = array_merge(array('cipher' => 'ecb', 'ignore' => 0, 'iv' => null), $opts);
     if (!($opts['ignore'] & self::IGNORE_OPENSSL) && Horde_Crypt_Blowfish_Openssl::supported()) {
         $this->_crypt = new Horde_Crypt_Blowfish_Openssl($opts['cipher']);
     } elseif (!($opts['ignore'] & self::IGNORE_MCRYPT) && Horde_Crypt_Blowfish_Mcrypt::supported()) {
         $this->_crypt = new Horde_Crypt_Blowfish_Mcrypt($opts['cipher']);
     } else {
         $this->_crypt = new Horde_Crypt_Blowfish_Php($opts['cipher']);
     }
     $this->setKey($key, $opts['iv']);
 }