From 4d30878d8efb86fd110c3693024db5da7aceb776 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 19 Jan 2018 00:02:21 +0300 Subject: Add abbreviated_string() to sha* classes --- libbutl/sha1.mxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libbutl/sha1.mxx') diff --git a/libbutl/sha1.mxx b/libbutl/sha1.mxx index 5259189..7ba3c0a 100644 --- a/libbutl/sha1.mxx +++ b/libbutl/sha1.mxx @@ -77,6 +77,12 @@ LIBBUTL_MODEXPORT namespace butl const char* string () const; + std::string + abbreviated_string (std::size_t n) const + { + return std::string (string (), n < 40 ? n : 40); + } + private: struct context // Note: identical to SHA1_CTX. { -- cgit v1.1