aboutsummaryrefslogtreecommitdiff
path: root/libbutl/sha256.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl/sha256.cxx')
-rw-r--r--libbutl/sha256.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/libbutl/sha256.cxx b/libbutl/sha256.cxx
index 6dbe2a0..31730a2 100644
--- a/libbutl/sha256.cxx
+++ b/libbutl/sha256.cxx
@@ -67,7 +67,7 @@ namespace butl
{
sha256::
sha256 ()
- : done_ (false)
+ : done_ (false), empty_ (true)
{
SHA256_Init (reinterpret_cast<SHA256_CTX*> (buf_));
}
@@ -75,7 +75,13 @@ namespace butl
void sha256::
append (const void* b, size_t n)
{
- SHA256_Update (reinterpret_cast<SHA256_CTX*> (buf_), b, n);
+ if (n != 0)
+ {
+ SHA256_Update (reinterpret_cast<SHA256_CTX*> (buf_), b, n);
+
+ if (empty_)
+ empty_ = false;
+ }
}
void sha256::