1#ifndef CRYPTOPP_BASE32_H
2#define CRYPTOPP_BASE32_H
3
4#include "basecode.h"
5
6NAMESPACE_BEGIN(CryptoPP)
7
8//! Converts given data to base 32, the default code is based on draft-ietf-idn-dude-02.txt
9/*! To specify alternative code, call Initialize() with EncodingLookupArray parameter. */
10class Base32Encoder : public SimpleProxyFilter
11{
12public:
13	Base32Encoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
14		: SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
15	{
16		IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator)));
17	}
18
19	void IsolatedInitialize(const NameValuePairs &parameters);
20};
21
22//! Decode base 32 data back to bytes, the default code is based on draft-ietf-idn-dude-02.txt
23/*! To specify alternative code, call Initialize() with DecodingLookupArray parameter. */
24class Base32Decoder : public BaseN_Decoder
25{
26public:
27	Base32Decoder(BufferedTransformation *attachment = NULL)
28		: BaseN_Decoder(GetDefaultDecodingLookupArray(), 5, attachment) {}
29
30	void IsolatedInitialize(const NameValuePairs &parameters);
31
32private:
33	static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
34};
35
36NAMESPACE_END
37
38#endif
39