util: Add constructor of Digest object from std::istream&
Change-Id: Ie3fa6511da751fe3b7b39d7a18b4909a28376d02
Refs: #3022
diff --git a/src/util/digest.cpp b/src/util/digest.cpp
index 156d372..664df2b 100644
--- a/src/util/digest.cpp
+++ b/src/util/digest.cpp
@@ -32,6 +32,19 @@
}
template<typename Hash>
+Digest<Hash>::Digest(std::istream& is)
+ : m_isInProcess(false)
+ , m_isFinalized(true)
+{
+ using namespace CryptoPP;
+
+ m_buffer = make_shared<Buffer>(m_hash.DigestSize());
+ FileSource(is, true,
+ new HashFilter(m_hash,
+ new ArraySink(m_buffer->get(), m_buffer->size())));
+}
+
+template<typename Hash>
void
Digest<Hash>::reset()
{