From b5caa368ed9ed12d0114ab9bd76ff04d1a57c13a Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 23 Sep 2010 21:12:34 +0000 Subject: Add a convenience overload of hex_encode taking a MemoryRegion& --- src/codec/hex/hex.cpp | 8 ++++++++ src/codec/hex/hex.h | 9 +++++++++ 2 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/codec/hex/hex.cpp b/src/codec/hex/hex.cpp index 6cef71fec..8efdd3ccd 100644 --- a/src/codec/hex/hex.cpp +++ b/src/codec/hex/hex.cpp @@ -34,6 +34,14 @@ void hex_encode(char output[], } } +std::string hex_encode(const MemoryRegion& input, + bool uppercase) + { + return hex_encode(&input[0], + input.size(), + uppercase); + } + std::string hex_encode(const byte input[], u32bit input_length, bool uppercase) diff --git a/src/codec/hex/hex.h b/src/codec/hex/hex.h index 91a743b45..afef1ec84 100644 --- a/src/codec/hex/hex.h +++ b/src/codec/hex/hex.h @@ -36,6 +36,15 @@ std::string BOTAN_DLL hex_encode(const byte input[], u32bit input_length, bool uppercase = true); +/** +* Perform hex encoding +* @param input some input +* @param uppercase should output be upper or lower case? +* @return hexadecimal representation of input +*/ +std::string BOTAN_DLL hex_encode(const MemoryRegion& input, + bool uppercase = true); + /** * Perform hex decoding * @param output an array of at least input_length/2 bytes -- cgit v1.2.3