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

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

There is no need to hash inputs or outputs of Security::encryptByKey or Security::encryptByPassword as those methods perform the task.
См. также: validateData()
См. также: generateRandomKey()
См. также: hkdf()
См. также: pbkdf2()
public hashData ( string $data, string $key, boolean $rawHash = false ) : string
$data string the data to be protected
$key string the secret key to be used for generating hash. Should be a secure cryptographic key.
$rawHash boolean whether the generated hash value is in raw binary format. If false, lowercase hex digits will be generated.
Результат string the data prefixed with the keyed hash
    public function hashData($data, $key, $rawHash = false)
    {
        $hash = hash_hmac($this->macHash, $data, $key, $rawHash);
        if (!$hash) {
            throw new InvalidConfigException('Failed to generate HMAC with hash algorithm: ' . $this->macHash);
        }
        return $hash . $data;
    }