0
|
1 |
/*
|
|
2 |
cdecode.h - c header for a base64 decoding algorithm
|
|
3 |
This is part of the libb64 project, and has been placed in the public domain.
|
|
4 |
For details, see http://sourceforge.net/projects/libb64
|
|
5 |
*/
|
|
6 |
|
|
7 |
#ifndef _INCL_BASE64_H_
|
|
8 |
#define _INCL_BASE64_H_
|
|
9 |
|
|
10 |
#include <stdint.h>
|
|
11 |
|
|
12 |
typedef enum
|
|
13 |
{
|
|
14 |
step_a, step_b, step_c, step_d
|
|
15 |
} base64_decodestep;
|
|
16 |
|
|
17 |
typedef struct
|
|
18 |
{
|
|
19 |
base64_decodestep step;
|
|
20 |
char plainchar;
|
|
21 |
} base64_decodestate;
|
|
22 |
|
|
23 |
void base64_init_decodestate(base64_decodestate* state_in);
|
|
24 |
int base64_decode_value(char value_in);
|
|
25 |
int base64_decode_block(const char* code_in, const int length_in, uint8_t* plaintext_out, base64_decodestate* state_in);
|
|
26 |
|
|
27 |
|
|
28 |
typedef enum
|
|
29 |
{
|
|
30 |
step_A, step_B, step_C
|
|
31 |
} base64_encodestep;
|
|
32 |
|
|
33 |
typedef struct
|
|
34 |
{
|
|
35 |
base64_encodestep step;
|
|
36 |
char result;
|
|
37 |
int stepcount;
|
|
38 |
} base64_encodestate;
|
|
39 |
|
|
40 |
void base64_init_encodestate(base64_encodestate* state_in);
|
|
41 |
char base64_encode_value(char value_in);
|
|
42 |
int base64_encode_block(const uint8_t* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in);
|
|
43 |
int base64_encode_blockend(char* code_out, base64_encodestate* state_in);
|
|
44 |
|
|
45 |
#endif
|
|
46 |
|