From 88adf3f7f2e9c6f1ea3c722ead41a5579b3292bf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 5 Oct 2019 08:30:00 +0200 Subject: Add sha{1,256}::empty() --- libbutl/sha256.mxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libbutl/sha256.mxx') diff --git a/libbutl/sha256.mxx b/libbutl/sha256.mxx index fca8b91..2bb58b3 100644 --- a/libbutl/sha256.mxx +++ b/libbutl/sha256.mxx @@ -108,6 +108,11 @@ LIBBUTL_MODEXPORT namespace butl explicit sha256 (ifdstream& i): sha256 () {append (i);} + // Check if any data has been hashed. + // + bool + empty () const {return empty_;} + // Extract result. // // It can be obtained as either a 32-byte binary digest or as a 64- @@ -143,6 +148,7 @@ LIBBUTL_MODEXPORT namespace butl mutable digest_type bin_; mutable bool done_; + bool empty_; }; // Convert a SHA256 string representation (64 hex digits) to the fingerprint -- cgit v1.1