ext-cryptopp/hex.h

37 lines
1.0 KiB
C
Raw Normal View History

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
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)
{
2003-07-18 04:35:30 +00:00
IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator)));
2002-10-04 17:31:41 +00:00
}
void IsolatedInitialize(const NameValuePairs &parameters);
};
2003-03-20 01:24:12 +00:00
//! Decode base 16 data back to bytes
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 &parameters);
2002-10-04 17:31:41 +00:00
private:
2003-07-18 04:35:30 +00:00
static const int *GetDefaultDecodingLookupArray();
2002-10-04 17:31:41 +00:00
};
NAMESPACE_END
#endif