Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Base32.h

Go to the documentation of this file.
00001 #ifndef BASE32_H
00002 #define BASE32_H
00003 
00028 #include <iostream>
00029 #include <cstdlib>
00030 
00031 #include <string.h>
00032 #include <assert.h>
00033 #include <stddef.h>
00034 
00035 using namespace std;
00036 
00037 extern int divceil(int a, int b);
00038 
00039 class Base32 {
00040 
00041  public:
00042 
00052     Base32(const string encoded);
00053 
00067     Base32(const string encoded, int noOfBits);
00068 
00082     Base32(const unsigned char* data, int noOfBits);
00083 
00084     ~Base32();
00085 
00106     const unsigned char* getDecoded(int &length);
00107 
00118     const string getEncoded() { return encoded; };
00119 
00129     static size_t const b2alen(const size_t lengthInBits) {
00130         return divceil(lengthInBits, 5); };
00131 
00132  private:
00133 
00160     void a2b_l(const string cs, size_t size, const size_t lengthinbits);
00161 
00196     void b2a_l(const unsigned char* cs, int len, const size_t noOfBits);
00197 
00201     unsigned char *binaryResult;
00202 
00206     int resultLength;
00207 
00211     string encoded;
00212 
00213     unsigned char smallBuffer[128];
00214 };
00215 #endif

© sourcejam.com 2005-2008