Автор: Andres Gutierrez (andres@phalconphp.com)
Автор: Nikolaos Dimopoulos (nikos@phalconphp.com)
Наследование: extends Phalcon\Security
Пример #1
0
 /**
  * Tests Security::hash
  */
 public function testHash()
 {
     $this->specify('The Security::hash works incorrectly', function () {
         $s = new Security();
         $password = '******';
         $s->setDefaultHash(Security::CRYPT_DEFAULT);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_STD_DES);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_EXT_DES);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_BLOWFISH);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_BLOWFISH_A);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_BLOWFISH_X);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_BLOWFISH_Y);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_SHA256);
         expect($s->checkHash($password, $s->hash($password)))->true();
         $s->setDefaultHash(Security::CRYPT_SHA512);
         expect($s->checkHash($password, $s->hash($password)))->true();
     });
 }