-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase64.h
48 lines (37 loc) · 1.23 KB
/
base64.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef __BASE64_DEFINED___
#define __BASE64_DEFINED___
#define ENCODE 0
#define DECODE 1
#define CODE_ERR 0
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define MAXBUFFER 4096 // Don`t change this parameter !!!
#define READBYTES 3072 // Don`t change this parameter !!!
/* Bits BASE64 structure */
typedef struct __Bits64__ {
unsigned b3 : 6; /* 1 Base 64 character */
unsigned b2 : 6; /* 2 Base 64 character */
unsigned b1 : 6; /* 3 Base 64 character */
unsigned b0 : 6; /* 4 Base 64 character */
} BITS, *BITSPTR;
/* Union of Bits & Bytes */
typedef union __Base64__ {
char a[3]; /* Byte array in the case */
BITS b; /* Bits fields in the case */
} BASE64;
/* Base_64 index structure */
typedef struct __index64__ {
char Ch;
int Id;
} INDEX64, *INDEX64PTR;
/* Prototypes */
size_t code64( int job, char *buf_ascii, size_t ascii_size, char *buf_64, size_t buf_64_size );
int idx64( char ch );
#endif /* __BASE64_DEFINED___ */