aboutsummaryrefslogtreecommitdiff
path: root/butl/sha256
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-04-20 13:25:18 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-04-21 14:32:18 +0300
commitc1d9742df3cf20c3b235ecdd4f4d7a6f71037f1d (patch)
tree838df08ffbec943b315252748d64f719f537fd7d /butl/sha256
parentc0beeb5f0b3285fd7b411859bd68d44b472ad034 (diff)
Add sha256_to_fingerprint (), fingerprint_to_sha256 ()
Diffstat (limited to 'butl/sha256')
-rw-r--r--butl/sha25615
1 files changed, 15 insertions, 0 deletions
diff --git a/butl/sha256 b/butl/sha256
index d583701..a1d0c38 100644
--- a/butl/sha256
+++ b/butl/sha256
@@ -79,6 +79,21 @@ namespace butl
mutable digest_type bin_;
mutable bool done_;
};
+
+ // Convert a SHA256 string representation (64 hex digits) to the fingerprint
+ // canonical representation (32 colon-separated upper case hex digit pairs,
+ // like 01:AB:CD:...). Throw invalid_argument if the argument is not a valid
+ // SHA256 string.
+ //
+ std::string
+ sha256_to_fingerprint (const std::string&);
+
+ // Convert a fingerprint (32 colon-separated hex digit pairs) to the SHA256
+ // string representation (64 lower case hex digits). Throw invalid_argument
+ // if the argument is not a valid fingerprint.
+ //
+ std::string
+ fingerprint_to_sha256 (const std::string&);
};
#endif // BUTL_SHA256