yii\base\Security::encryptByKey PHP Méthode

encryptByKey() public méthode

Derives keys for encryption and authentication from the input key using HKDF and a random salt, which is very fast relative to Security::encryptByPassword. The input key must be properly random -- use Security::generateRandomKey to generate keys. The encrypted data includes a keyed message authentication code (MAC) so there is no need to hash input or output data.
See also: decryptByKey()
See also: encryptByPassword()
public encryptByKey ( string $data, string $inputKey, string $info = null ) : string
$data string the data to encrypt
$inputKey string the input to use for encryption and authentication
$info string optional context and application specific information, see [[hkdf()]]
Résultat string the encrypted data
    public function encryptByKey($data, $inputKey, $info = null)
    {
        return $this->encrypt($data, false, $inputKey, $info);
    }