From 2fe7c710b13a0cd429b800fe5e147414c6c63596 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 20 Oct 2017 05:20:03 +0300 Subject: Make use of butl::sha256 class --- bpkg/checksum.hxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'bpkg/checksum.hxx') diff --git a/bpkg/checksum.hxx b/bpkg/checksum.hxx index ec5a82e..2342250 100644 --- a/bpkg/checksum.hxx +++ b/bpkg/checksum.hxx @@ -5,6 +5,8 @@ #ifndef BPKG_CHECKSUM_HXX #define BPKG_CHECKSUM_HXX +#include + #include #include @@ -12,18 +14,22 @@ namespace bpkg { - // Calculate SHA256 sum of the specified memory buffer in binary mode. Issue - // diagnostics and throw failed if anything goes wrong. + // Calculate SHA256 sum of the specified memory buffer in binary mode. // - string - sha256 (const common_options&, const char* buf, size_t n); + inline string + sha256 (const char* buf, size_t n) {return butl::sha256 (buf, n).string ();} // The same but for a stream (if ifdstream, open in binary mode). // string - sha256 (const common_options&, istream&); + sha256 (istream&); - // The same but for a file. + // The same but for a file. Issue diagnostics and throw failed if anything + // goes wrong. + // + // Note that unlike the other overloads, this function runs the sha256 + // program underneath. The reason for this is that the program can be + // optimized for the platform. // string sha256 (const common_options&, const path& file); -- cgit v1.1