From f50b4deff7579cc11c2933bec51615e4a34d0401 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 6 Sep 2021 20:09:19 +0200 Subject: [PATCH] wip #4666 @0.5 --- src/PDF/Document.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PDF/Document.php b/src/PDF/Document.php index c3ebc57..daecb3a 100644 --- a/src/PDF/Document.php +++ b/src/PDF/Document.php @@ -10,6 +10,11 @@ class Document { protected $in; + /** + * @var string + */ + protected $hash = null; + /** * @var int */ @@ -29,6 +34,17 @@ class Document $this->in = $in; } + /** + * @return string + */ + public function getHash(): string + { + if (null === $this->hash) { + $this->hash = hash_file('sha256', $this->in, false); + } + return $this->hash; + } + public function getInfos($force = false) { if (!$force && $this->pages) { -- 2.39.5