monotone

monotone Mtn Source Tree

Root/cryptopp/basecode.h

1#ifndef CRYPTOPP_BASECODE_H
2#define CRYPTOPP_BASECODE_H
3
4#include "filters.h"
5#include "algparam.h"
6
7NAMESPACE_BEGIN(CryptoPP)
8
9class BaseN_Encoder : public Unflushable<Filter>
10{
11public:
12BaseN_Encoder(BufferedTransformation *attachment=NULL)
13: Unflushable<Filter>(attachment) {}
14
15BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)
16: Unflushable<Filter>(attachment)
17{
18IsolatedInitialize(MakeParameters("EncodingLookupArray", alphabet)
19("Log2Base", log2base)
20("Pad", padding != -1)
21("PaddingByte", byte(padding)));
22}
23
24void IsolatedInitialize(const NameValuePairs &parameters);
25unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
26
27private:
28const byte *m_alphabet;
29int m_padding, m_bitsPerChar, m_outputBlockSize;
30int m_bytePos, m_bitPos;
31SecByteBlock m_outBuf;
32};
33
34class BaseN_Decoder : public Unflushable<Filter>
35{
36public:
37BaseN_Decoder(BufferedTransformation *attachment=NULL)
38: Unflushable<Filter>(attachment) {}
39
40BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)
41: Unflushable<Filter>(attachment)
42{
43IsolatedInitialize(MakeParameters("DecodingLookupArray", lookup)("Log2Base", log2base));
44}
45
46void IsolatedInitialize(const NameValuePairs &parameters);
47unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
48
49static void InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int log2base, bool caseInsensitive);
50
51private:
52const int *m_lookup;
53int m_padding, m_bitsPerChar, m_outputBlockSize;
54int m_bytePos, m_bitPos;
55SecByteBlock m_outBuf;
56};
57
58class Grouper : public Bufferless<Filter>
59{
60public:
61Grouper(BufferedTransformation *attachment=NULL)
62: Bufferless<Filter>(attachment) {}
63
64Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)
65: Bufferless<Filter>(attachment)
66{
67IsolatedInitialize(MakeParameters("GroupSize", groupSize)
68("Separator", ConstByteArrayParameter(separator))
69("Terminator", ConstByteArrayParameter(terminator)));
70}
71
72void IsolatedInitialize(const NameValuePairs &parameters);
73unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
74
75private:
76SecByteBlock m_separator, m_terminator;
77unsigned int m_groupSize, m_counter;
78};
79
80NAMESPACE_END
81
82#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status