lithium\tests\cases\security\PasswordTest::testSaltXDES PHP Method

testSaltXDES() public method

Tests salting passwords with the Extended-DES algorithm.
public testSaltXDES ( )
    public function testSaltXDES()
    {
        $this->skipIf(!CRYPT_EXT_DES, 'Extended-DES is not supported.');
        $saltPattern = "{^_[0-9A-Za-z./]{8}\$}";
        $hashPattern = "{^_[0-9A-Za-z./]{19}\$}";
        $log2 = 18;
        $salt = Password::salt('xdes', $log2);
        $this->assertPattern($saltPattern, $salt);
        $this->assertNotEqual($salt, Password::salt('xdes', $log2));
        $hash = Password::hash($this->_password, $salt);
        $hash2 = Password::hash($this->_password, Password::salt('xdes', $log2));
        $this->assertPattern($hashPattern, $hash);
        $this->assertNotEqual($hash, $hash2);
    }