monotone

monotone Mtn Source Tree

Root/botan/base64.h

1/*************************************************
2* Base64 Encoder/Decoder Header File *
3* (C) 1999-2005 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_BASE64_H__
7#define BOTAN_BASE64_H__
8
9#include <botan/filter.h>
10
11namespace Botan {
12
13/*************************************************
14* Base64 Encoder *
15*************************************************/
16class Base64_Encoder : public Filter
17 {
18 public:
19 static void encode(const byte[3], byte[4]);
20
21 void write(const byte[], u32bit);
22 void end_msg();
23 Base64_Encoder(bool = true, u32bit = 72);
24 private:
25 void encode_and_send(const byte[], u32bit);
26 void do_output(const byte[], u32bit);
27 static const byte BIN_TO_BASE64[64];
28
29 const u32bit line_length;
30 SecureVector<byte> in, out;
31 u32bit position, counter;
32 };
33
34/*************************************************
35* Base64 Decoder *
36*************************************************/
37class Base64_Decoder : public Filter
38 {
39 public:
40 static void decode(const byte[4], byte[3]);
41 static bool is_valid(byte);
42
43 void write(const byte[], u32bit);
44 void end_msg();
45 Base64_Decoder(Decoder_Checking = NONE);
46 private:
47 void decode_and_send(const byte[], u32bit);
48 void handle_bad_char(byte);
49 static const byte BASE64_TO_BIN[256];
50
51 const Decoder_Checking checking;
52 SecureVector<byte> in, out;
53 u32bit position;
54 };
55
56}
57
58#endif

Archive Download this file

Branches

Tags

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