monotone

monotone Mtn Source Tree

Root/botan/base64.h

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

Archive Download this file

Branches

Tags

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