aboutsummaryrefslogtreecommitdiff
path: root/libbutl/sha1.mxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-01-19 00:02:21 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-08 20:49:08 +0300
commit4d30878d8efb86fd110c3693024db5da7aceb776 (patch)
treeb46ac328b499989ce27e48ca48bcc16f9f42d882 /libbutl/sha1.mxx
parenta12216dd1ed9582fc96805189caadc2b733a4e70 (diff)
Add abbreviated_string() to sha* classes
Diffstat (limited to 'libbutl/sha1.mxx')
-rw-r--r--libbutl/sha1.mxx6
1 files changed, 6 insertions, 0 deletions
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.
{