aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-23 21:12:34 +0000
committerlloyd <[email protected]>2010-09-23 21:12:34 +0000
commitb5caa368ed9ed12d0114ab9bd76ff04d1a57c13a (patch)
treeb31fd9825d9fcd15e720e574b2353f81d1db08b3
parent6458ec6631dd905afb23978f18ab1ee23d383411 (diff)
Add a convenience overload of hex_encode taking a MemoryRegion<byte>&
-rw-r--r--src/codec/hex/hex.cpp8
-rw-r--r--src/codec/hex/hex.h9
2 files changed, 17 insertions, 0 deletions
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<byte>& 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
@@ -37,6 +37,15 @@ std::string BOTAN_DLL hex_encode(const byte input[],
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<byte>& input,
+ bool uppercase = true);
+
+/**
* Perform hex decoding
* @param output an array of at least input_length/2 bytes
* @param input some hex input