diff options
Diffstat (limited to 'src/codec/hex/hex.h')
-rw-r--r-- | src/codec/hex/hex.h | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/src/codec/hex/hex.h b/src/codec/hex/hex.h deleted file mode 100644 index a64a6c8df..000000000 --- a/src/codec/hex/hex.h +++ /dev/null @@ -1,148 +0,0 @@ -/* -* Hex Encoding and Decoding -* (C) 2010 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_HEX_CODEC_H__ -#define BOTAN_HEX_CODEC_H__ - -#include <botan/secmem.h> -#include <string> - -namespace Botan { - -/** -* Perform hex encoding -* @param output an array of at least input_length*2 bytes -* @param input is some binary data -* @param input_length length of input in bytes -* @param uppercase should output be upper or lower case? -*/ -void BOTAN_DLL hex_encode(char output[], - const byte input[], - size_t input_length, - bool uppercase = true); - -/** -* Perform hex encoding -* @param input some input -* @param input_length length of input in bytes -* @param uppercase should output be upper or lower case? -* @return hexadecimal representation of input -*/ -std::string BOTAN_DLL hex_encode(const byte input[], - size_t 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 -*/ -template<typename Alloc> -std::string hex_encode(const std::vector<byte, Alloc>& input, - bool uppercase = true) - { - return hex_encode(&input[0], input.size(), uppercase); - } - -/** -* Perform hex decoding -* @param output an array of at least input_length/2 bytes -* @param input some hex input -* @param input_length length of input in bytes -* @param input_consumed is an output parameter which says how many -* bytes of input were actually consumed. If less than -* input_length, then the range input[consumed:length] -* should be passed in later along with more input. -* @param ignore_ws ignore whitespace on input; if false, throw an - exception if whitespace is encountered -* @return number of bytes written to output -*/ -size_t BOTAN_DLL hex_decode(byte output[], - const char input[], - size_t input_length, - size_t& input_consumed, - bool ignore_ws = true); - -/** -* Perform hex decoding -* @param output an array of at least input_length/2 bytes -* @param input some hex input -* @param input_length length of input in bytes -* @param ignore_ws ignore whitespace on input; if false, throw an - exception if whitespace is encountered -* @return number of bytes written to output -*/ -size_t BOTAN_DLL hex_decode(byte output[], - const char input[], - size_t input_length, - bool ignore_ws = true); - -/** -* Perform hex decoding -* @param output an array of at least input_length/2 bytes -* @param input some hex input -* @param ignore_ws ignore whitespace on input; if false, throw an - exception if whitespace is encountered -* @return number of bytes written to output -*/ -size_t BOTAN_DLL hex_decode(byte output[], - const std::string& input, - bool ignore_ws = true); - -/** -* Perform hex decoding -* @param input some hex input -* @param input_length the length of input in bytes -* @param ignore_ws ignore whitespace on input; if false, throw an - exception if whitespace is encountered -* @return decoded hex output -*/ -std::vector<byte> BOTAN_DLL -hex_decode(const char input[], - size_t input_length, - bool ignore_ws = true); - -/** -* Perform hex decoding -* @param input some hex input -* @param ignore_ws ignore whitespace on input; if false, throw an - exception if whitespace is encountered -* @return decoded hex output -*/ -std::vector<byte> BOTAN_DLL -hex_decode(const std::string& input, - bool ignore_ws = true); - - -/** -* Perform hex decoding -* @param input some hex input -* @param input_length the length of input in bytes -* @param ignore_ws ignore whitespace on input; if false, throw an - exception if whitespace is encountered -* @return decoded hex output -*/ -secure_vector<byte> BOTAN_DLL -hex_decode_locked(const char input[], - size_t input_length, - bool ignore_ws = true); - -/** -* Perform hex decoding -* @param input some hex input -* @param ignore_ws ignore whitespace on input; if false, throw an - exception if whitespace is encountered -* @return decoded hex output -*/ -secure_vector<byte> BOTAN_DLL -hex_decode_locked(const std::string& input, - bool ignore_ws = true); - -} - -#endif |