Add streaming support to LZ4 compress routine
In preparation to enable lz4diff streaming mode.
Instead of append data to std::vector, lz4diff APIs
now accept a sink function which we send computed data
to. This way, caller can choose to cache data in memory,
or stream writes to disk as data comes.
Bug: 206729162
Test: th
Change-Id: Ib1aea5c1b730d30a1b4814f8d5dd8ce3a8b43826
diff --git a/common/hash_calculator.h b/common/hash_calculator.h
index 4426128..dd7b2e8 100644
--- a/common/hash_calculator.h
+++ b/common/hash_calculator.h
@@ -76,6 +76,10 @@
off_t length,
brillo::Blob* out_hash);
static bool RawHashOfFile(const std::string& name, brillo::Blob* out_hash);
+ static std::string SHA256Digest(std::string_view blob);
+
+ static std::string SHA256Digest(std::vector<unsigned char> blob);
+ static std::string SHA256Digest(std::vector<char> blob);
private:
// If non-empty, the final raw hash. Will only be set to non-empty when