aboutsummaryrefslogtreecommitdiff
path: root/libbutl/sha256.mxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-05 08:30:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-05 08:30:00 +0200
commit88adf3f7f2e9c6f1ea3c722ead41a5579b3292bf (patch)
tree8329c7f984ea18c6cb35cc1b5ec77f1b39d8656f /libbutl/sha256.mxx
parentf6675a4626267c08e53bbc20bd3dd41ac8744605 (diff)
Add sha{1,256}::empty()
Diffstat (limited to 'libbutl/sha256.mxx')
-rw-r--r--libbutl/sha256.mxx6
1 files changed, 6 insertions, 0 deletions
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