Pop\Crypt\Mcrypt::setSalt PHP Méthode

setSalt() public méthode

Method to set the salt
public setSalt ( string $salt = null ) : self
$salt string
Résultat self
    public function setSalt($salt = null)
    {
        $this->salt = $salt;
        return $this;
    }

Usage Example

Exemple #1
0
 public function testMcrypt()
 {
     $crypt = new Crypt\Mcrypt();
     $crypt->setSalt('Test Salt');
     $this->assertEquals('Test Salt', $crypt->getSalt());
     $this->assertEquals(MCRYPT_RIJNDAEL_256, $crypt->getCipher());
     $this->assertEquals(MCRYPT_MODE_CBC, $crypt->getMode());
     $this->assertEquals(MCRYPT_RAND, $crypt->getSource());
     $hash = $crypt->create('12password34');
     $this->assertTrue($crypt->verify('12password34', $hash));
     $this->assertNotNull($crypt->getIv());
     $this->assertNotNull($crypt->getIvSize());
     $this->assertEquals('12password34', $crypt->decrypt($hash));
 }
All Usage Examples Of Pop\Crypt\Mcrypt::setSalt