yii\base\Security::encryptByPassword PHP Метод

encryptByPassword() публичный Метод

Derives keys for encryption and authentication from the password using PBKDF2 and a random salt, which is deliberately slow to protect against dictionary attacks. Use Security::encryptByKey to encrypt fast using a cryptographic key rather than a password. Key derivation time is determined by [[$derivationIterations]], which should be set as high as possible. The encrypted data includes a keyed message authentication code (MAC) so there is no need to hash input or output data. > Note: Avoid encrypting with passwords wherever possible. Nothing can protect against poor-quality or compromised passwords.
См. также: decryptByPassword()
См. также: encryptByKey()
public encryptByPassword ( string $data, string $password ) : string
$data string the data to encrypt
$password string the password to use for encryption
Результат string the encrypted data
    public function encryptByPassword($data, $password)
    {
        return $this->encrypt($data, true, $password, null);
    }