base32.h

00001 #ifndef CRYPTOPP_BASE32_H
00002 #define CRYPTOPP_BASE32_H
00003 
00004 #include "basecode.h"
00005 
00006 NAMESPACE_BEGIN(CryptoPP)
00007 
00008 //! Converts given data to base 32, the default code is based on draft-ietf-idn-dude-02.txt
00009 /*! To specify alternative code, call Initialize() with EncodingLookupArray parameter. */
00010 class Base32Encoder : public SimpleProxyFilter
00011 {
00012 public:
00013         Base32Encoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
00014                 : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
00015         {
00016                 IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator)));
00017         }
00018 
00019         void IsolatedInitialize(const NameValuePairs &parameters);
00020 };
00021 
00022 //! Decode base 32 data back to bytes, the default code is based on draft-ietf-idn-dude-02.txt
00023 /*! To specify alternative code, call Initialize() with DecodingLookupArray parameter. */
00024 class Base32Decoder : public BaseN_Decoder
00025 {
00026 public:
00027         Base32Decoder(BufferedTransformation *attachment = NULL)
00028                 : BaseN_Decoder(GetDefaultDecodingLookupArray(), 5, attachment) {}
00029 
00030         void IsolatedInitialize(const NameValuePairs &parameters);
00031 
00032 private:
00033         static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
00034 };
00035 
00036 NAMESPACE_END
00037 
00038 #endif

Generated on Sat Dec 23 02:07:05 2006 for Crypto++ by  doxygen 1.5.1-p1