Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

# hex.h

    00001 #ifndef CRYPTOPP_HEX_H
    00002 #define CRYPTOPP_HEX_H
    00003
    00004 #include "basecode.h"
    00005
    00006 NAMESPACE_BEGIN(CryptoPP)
    00007
    00008 //! Converts given data to base 16
    00009 class CRYPTOPP_DLL HexEncoder : public SimpleProxyFilter
    00010 {
    00011 public:
    00012         HexEncoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
    00013                 : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
    00014         {
    00015                 IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator)));
    00016         }
    00017
    00018         void IsolatedInitialize(const NameValuePairs &parameters);
    00019 };
    00020
    00021 //! Decode base 16 data back to bytes
    00022 class CRYPTOPP_DLL HexDecoder : public BaseN_Decoder
    00023 {
    00024 public:
    00025         HexDecoder(BufferedTransformation *attachment = NULL)
    00026                 : BaseN_Decoder(GetDefaultDecodingLookupArray(), 4, attachment) {}
    00027
    00028         void IsolatedInitialize(const NameValuePairs &parameters);
    00029
    00030 private:
    00031         static const int *GetDefaultDecodingLookupArray();
    00032 };
    00033
    00034 NAMESPACE_END
    00035
    00036 #endif