code: 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;
      }
docs: Prefixes data with a keyed hash value so that it can later be detected if it is tampered.
  There is no need to hash inputs or outputs of [[encryptByKey()]] or [[encryptByPassword()]]
  as those methods perform the task.
  @param string $data the data to be protected
  @param string $key the secret key to be used for generating hash. Should be a secure
  cryptographic key.
  @param bool $rawHash whether the generated hash value is in raw binary format. If false, lowercase
  hex digits will be generated.
  @return string the data prefixed with the keyed hash
  @throws InvalidConfigException when HMAC generation fails.
  @see validateData()
  @see generateRandomKey()
  @see hkdf()
  @see pbkdf2()