Allow aos::Sha256() to take a file path
This enables writing some tests where we want to conveniently compare
that the contents of two files are identical or haven't changed from
some known-good baseline.
Change-Id: I7f62fb1b3fffb7feafd34dd776e8a4981820b7d6
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/sha256.h b/aos/sha256.h
index 7fb9b2f..117bc14 100644
--- a/aos/sha256.h
+++ b/aos/sha256.h
@@ -1,6 +1,7 @@
#ifndef AOS_SHA256_H_
#define AOS_SHA256_H_
+#include <filesystem>
#include <string>
#include "absl/types/span.h"
@@ -9,6 +10,10 @@
// Returns the sha256 of a span.
std::string Sha256(const absl::Span<const uint8_t> str);
+std::string Sha256(std::string_view str);
+
+// Returns the Sha256 of the specified file. Dies on failure to read the file.
+std::string Sha256OfFile(std::filesystem::path file);
} // namespace aos