1
#ifndef CRYPTOPP_BASECODE_H
2
#define CRYPTOPP_BASECODE_H
8
NAMESPACE_BEGIN(CryptoPP)
10
//! base n encoder, where n is a power of 2
11
class CRYPTOPP_DLL BaseN_Encoder : public Unflushable<Filter>
14
BaseN_Encoder(BufferedTransformation *attachment=NULL)
17
BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)
20
IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet)
21
(Name::Log2Base(), log2base)
22
(Name::Pad(), padding != -1)
23
(Name::PaddingByte(), byte(padding)));
26
void IsolatedInitialize(const NameValuePairs ¶meters);
27
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
30
const byte *m_alphabet;
31
int m_padding, m_bitsPerChar, m_outputBlockSize;
32
int m_bytePos, m_bitPos;
33
SecByteBlock m_outBuf;
36
//! base n decoder, where n is a power of 2
37
class CRYPTOPP_DLL BaseN_Decoder : public Unflushable<Filter>
40
BaseN_Decoder(BufferedTransformation *attachment=NULL)
43
BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)
46
IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base));
49
void IsolatedInitialize(const NameValuePairs ¶meters);
50
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
52
static void CRYPTOPP_API InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive);
56
int m_padding, m_bitsPerChar, m_outputBlockSize;
57
int m_bytePos, m_bitPos;
58
SecByteBlock m_outBuf;
61
//! filter that breaks input stream into groups of fixed size
62
class CRYPTOPP_DLL Grouper : public Bufferless<Filter>
65
Grouper(BufferedTransformation *attachment=NULL)
68
Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)
71
IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize)
72
(Name::Separator(), ConstByteArrayParameter(separator))
73
(Name::Terminator(), ConstByteArrayParameter(terminator)));
76
void IsolatedInitialize(const NameValuePairs ¶meters);
77
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
80
SecByteBlock m_separator, m_terminator;
81
size_t m_groupSize, m_counter;