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

hashData() public méthode

There is no need to hash inputs or outputs of Security::encryptByKey or Security::encryptByPassword as those methods perform the task.
See also: validateData()
See also: generateRandomKey()
See also: hkdf()
See also: 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.
Résultat 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;
    }