2002-10-04 17:31:41 +00:00
|
|
|
#ifndef CRYPTOPP_HEX_H
|
|
|
|
#define CRYPTOPP_HEX_H
|
|
|
|
|
|
|
|
#include "basecode.h"
|
|
|
|
|
|
|
|
NAMESPACE_BEGIN(CryptoPP)
|
|
|
|
|
|
|
|
//! Converts given data to base 16
|
2003-07-04 00:17:37 +00:00
|
|
|
class CRYPTOPP_DLL HexEncoder : public SimpleProxyFilter
|
2002-10-04 17:31:41 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-03-20 01:24:12 +00:00
|
|
|
HexEncoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
|
2002-10-04 17:31:41 +00:00
|
|
|
: SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
|
|
|
|
{
|
2006-12-09 17:12:14 +00:00
|
|
|
IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator))(Name::Terminator(), ConstByteArrayParameter(terminator)));
|
2002-10-04 17:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
|
|
|
};
|
|
|
|
|
2003-03-20 01:24:12 +00:00
|
|
|
//! Decode base 16 data back to bytes
|
2003-07-04 00:17:37 +00:00
|
|
|
class CRYPTOPP_DLL HexDecoder : public BaseN_Decoder
|
2002-10-04 17:31:41 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
HexDecoder(BufferedTransformation *attachment = NULL)
|
2003-07-18 04:35:30 +00:00
|
|
|
: BaseN_Decoder(GetDefaultDecodingLookupArray(), 4, attachment) {}
|
2002-10-04 17:31:41 +00:00
|
|
|
|
2003-07-18 04:35:30 +00:00
|
|
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
2002-10-04 17:31:41 +00:00
|
|
|
|
|
|
|
private:
|
2005-09-05 21:43:43 +00:00
|
|
|
static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
|
2002-10-04 17:31:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|