debug = hex_dump($data ?: $this->data()); } public function __get(string $key): mixed { switch ($key) { case 'signature': return $this->signature(); default: return parent::__get($key); } } /** * Calculate the signature of the data * * @param string $alg * @return string */ private function signature(string $alg='sha1'): string { if (! Arr::has($this->cache,'signature')) { if ($this->size) { $this->fopen(); $hash = hash_init($alg); while (!is_null($read = $this->fread(16384))) hash_update($hash, $read); $this->fclose(); $this->cache['signature'] = hash_final($hash); } else { $this->cache['signature'] = NULL; } } return $this->cache['signature']; } }