diff options
Diffstat (limited to 'libbutl/sha1.cxx')
-rw-r--r-- | libbutl/sha1.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libbutl/sha1.cxx b/libbutl/sha1.cxx index 1ca8a2a..3c1cbdc 100644 --- a/libbutl/sha1.cxx +++ b/libbutl/sha1.cxx @@ -73,7 +73,7 @@ namespace butl { sha1:: sha1 () - : done_ (false) + : done_ (false), empty_ (true) { SHA1_Init (reinterpret_cast<SHA1_CTX*> (buf_)); } @@ -81,7 +81,13 @@ namespace butl void sha1:: append (const void* b, size_t n) { - SHA1_Update (reinterpret_cast<SHA1_CTX*> (buf_), b, n); + if (n != 0) + { + SHA1_Update (reinterpret_cast<SHA1_CTX*> (buf_), b, n); + + if (empty_) + empty_ = false; + } } void sha1:: |