summaryrefslogtreecommitdiff
path: root/common/hash_calculator.cc
diff options
context:
space:
mode:
authorBrian Orr <brianorr@google.com>2021-05-10 11:39:59 -0700
committerBrian Orr <brianorr@google.com>2021-05-10 11:39:59 -0700
commitf79cb91b4218a68642c94a01defc0594e742b3f4 (patch)
tree01ec931931503ed80f181b2d85efb5df0079e4ba /common/hash_calculator.cc
parentd650df1d306a5a828e7b13a8cc954196fea44992 (diff)
parent3d4e6e0d7ed2b609e0fe2b4d0fcb250808f97476 (diff)
Merge SP1A.210510.001
Change-Id: If7498b293041f2ae00fd93563417d60a0c13e7c9
Diffstat (limited to 'common/hash_calculator.cc')
-rw-r--r--common/hash_calculator.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/hash_calculator.cc b/common/hash_calculator.cc
index d010a532..60812d56 100644
--- a/common/hash_calculator.cc
+++ b/common/hash_calculator.cc
@@ -95,6 +95,11 @@ bool HashCalculator::RawHashOfData(const brillo::Blob& data,
return RawHashOfBytes(data.data(), data.size(), out_hash);
}
+bool HashCalculator::RawHashOfFile(const string& name, brillo::Blob* out_hash) {
+ const auto file_size = utils::FileSize(name);
+ return RawHashOfFile(name, file_size, out_hash) == file_size;
+}
+
off_t HashCalculator::RawHashOfFile(const string& name,
off_t length,
brillo::Blob* out_hash) {