Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

base64.h

00001 #ifndef CRYPTOPP_BASE64_H
00002 #define CRYPTOPP_BASE64_H
00003 
00004 #include "cryptlib.h"
00005 #include "filters.h"
00006 
00007 NAMESPACE_BEGIN(CryptoPP)
00008 
00010 class Base64Encoder : public Filter
00011 {
00012 public:
00013         Base64Encoder(BufferedTransformation *outQueue = NULL, bool insertLineBreak = true);
00014 
00015         void Put(byte inByte)
00016         {
00017                 inBuf[inBufSize++]=inByte;
00018                 if (inBufSize==3)
00019                         EncodeQuantum();
00020         }
00021 
00022         void Put(const byte *inString, unsigned int length);
00023         void MessageEnd(int propagation=-1);
00024 
00025 private:
00026         void LineBreak();
00027         void EncodeQuantum();
00028 
00029         const bool insertLineBreak;
00030         int inBufSize;
00031         int lineLength;
00032         byte inBuf[3];
00033 };
00034 
00036 class Base64Decoder : public Filter
00037 {
00038 public:
00039         Base64Decoder(BufferedTransformation *outQueue = NULL);
00040 
00041         void Put(byte inByte)
00042         {
00043                 int i=ConvToNumber(inByte);
00044                 if (i >= 0)
00045                         inBuf[inBufSize++]=(byte) i;
00046                 if (inBufSize==4)
00047                         DecodeQuantum();
00048         }
00049 
00050         void Put(const byte *inString, unsigned int length);
00051         void MessageEnd(int propagation=-1);
00052 
00053 private:
00054         static int ConvToNumber(byte inByte);
00055         void DecodeQuantum();
00056 
00057         int inBufSize;
00058         byte inBuf[4];
00059 };
00060 
00061 NAMESPACE_END
00062 
00063 #endif

Generated at Mon Jan 15 01:16:29 2001 for Crypto++ by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000