summaryrefslogtreecommitdiffstats
path: root/Source/cmCryptoHash.h
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-08-18 11:58:04 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-08-18 12:17:50 (GMT)
commitf1c529c4fbea1963f7df92597a350e066319a1e1 (patch)
treea544103f96e0b03a8b659d4d5767360ec05ff1cf /Source/cmCryptoHash.h
parent34301441b963a2d7e02b4a4355a6634b3bbb7977 (diff)
downloadCMake-f1c529c4fbea1963f7df92597a350e066319a1e1.zip
CMake-f1c529c4fbea1963f7df92597a350e066319a1e1.tar.gz
CMake-f1c529c4fbea1963f7df92597a350e066319a1e1.tar.bz2
cmCryptoHash: Accept cm::string_view input
Diffstat (limited to 'Source/cmCryptoHash.h')
-rw-r--r--Source/cmCryptoHash.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index c7d3377..681f5cc 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -5,6 +5,8 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cm_string_view.hxx"
+
#include <memory>
#include <stddef.h>
#include <string>
@@ -42,7 +44,7 @@ public:
/// SHA3_224, SHA3_256, SHA3_384, SHA3_512
/// @return A valid auto pointer if algo is supported or
/// an invalid/NULL pointer otherwise
- static std::unique_ptr<cmCryptoHash> New(const char* algo);
+ static std::unique_ptr<cmCryptoHash> New(cm::string_view algo);
/// @brief Converts a hex character to its binary value (4 bits)
/// @arg input Hex character [0-9a-fA-F].
@@ -55,7 +57,7 @@ public:
/// @brief Calculates a binary hash from string input data
/// @return Binary hash vector
- std::vector<unsigned char> ByteHashString(const std::string& input);
+ std::vector<unsigned char> ByteHashString(cm::string_view input);
/// @brief Calculates a binary hash from file content
/// @see ByteHashString()
@@ -65,7 +67,7 @@ public:
/// @brief Calculates a hash string from string input data
/// @return Sequence of hex characters pairs for each byte of the binary hash
- std::string HashString(const std::string& input);
+ std::string HashString(cm::string_view input);
/// @brief Calculates a hash string from file content
/// @see HashString()
@@ -75,7 +77,7 @@ public:
void Initialize();
void Append(void const*, size_t);
- void Append(std::string const& str);
+ void Append(cm::string_view input);
std::vector<unsigned char> Finalize();
std::string FinalizeHex();