Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 1 | /* |
| 2 | cencode.h - c header for a base64 encoding algorithm |
| 3 | |
| 4 | This is part of the libb64 project, and has been placed in the public domain. |
| 5 | For details, see http://sourceforge.net/projects/libb64 |
| 6 | */ |
| 7 | |
| 8 | #ifndef BASE64_CENCODE_H |
| 9 | #define BASE64_CENCODE_H |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | #if defined(__cplusplus) |
| 14 | extern "C" |
| 15 | { |
| 16 | #endif |
| 17 | |
| 18 | typedef enum |
| 19 | { |
| 20 | step_A, step_B, step_C |
| 21 | } base64_encodestep; |
| 22 | |
| 23 | typedef struct |
| 24 | { |
| 25 | base64_encodestep step; |
| 26 | char result; |
| 27 | int stepcount; |
| 28 | int lineLength; |
| 29 | } base64_encodestate; |
| 30 | |
| 31 | void base64_init_encodestate(base64_encodestate* state_in, int lineLength); |
| 32 | |
| 33 | char base64_encode_value(const int8_t value_in); |
| 34 | |
| 35 | int base64_encode_block(const uint8_t *plaintext_in, int length_in, char* code_out, base64_encodestate* state_in); |
| 36 | |
| 37 | int base64_encode_blockend(char *code_out, base64_encodestate* state_in); |
| 38 | #if defined(__cplusplus) |
| 39 | } |
| 40 | #endif |
| 41 | |
| 42 | #endif /* BASE64_CENCODE_H */ |