#include <Base64.hh>
|
static int | encode (char *dest, const void *src, size_t size) |
|
static int | encode_P (char *dest, const void *src, size_t size) |
|
static int | encode (IOStream::Device *dest, const void *src, size_t size) |
|
static int | encode_P (IOStream::Device *dest, const void *src, size_t size) |
|
static int | decode (void *dest, const char *src, size_t size) |
|
Base64 encoder/decoder. Maps 3 bytes (24-bits) binary data to 4 printable characters, 32-bits. Allows encoding directly to an IOStream::Device such as the UART. Long string to an device is broken into multiple lines with a max length of 64 characters.
Acknowledgements
Inspired by implementation method by Bob Trower and Arduino Forum discussions.
References
- http://en.wikipedia.org/wiki/Base64
- https://tools.ietf.org/html/rfc4648
- http://base64.sourceforge.net
Definition at line 42 of file Base64.hh.
int Base64::decode |
( |
void * |
dest, |
|
|
const char * |
src, |
|
|
size_t |
size |
|
) |
| |
|
static |
Decode the size number of bytes in the source buffer to binary representation in the given destination buffer. The destination buffer must be able to hold the decoded data. The source buffer size must be even 4 character blocks (EINVAL is returned if not).
- Parameters
-
[in] | dest | destination buffer pointer (binary). |
[in] | src | source buffer pointer (string). |
[in] | size | number of bytes to decode. |
- Returns
- number of decoded bytes or negative error code.
Definition at line 181 of file Base64.cpp.
int Base64::encode |
( |
char * |
dest, |
|
|
const void * |
src, |
|
|
size_t |
size |
|
) |
| |
|
static |
Encode the size number of bytes in the source buffer to a null-terminated printable string in the given destination buffer. The destination buffer must be able to hold the encoded data and the terminating null.
- Parameters
-
[in] | dest | destination buffer pointer (string). |
[in] | src | source buffer pointer (binary). |
[in] | size | number of bytes to encode. |
- Returns
- length of string or negative error code.
Definition at line 31 of file Base64.cpp.
Encode the size number of bytes in the source buffer to given iostream device. A new-line is emitted every 64 characters.
- Parameters
-
[in] | dest | output stream device. |
[in] | src | source buffer pointer (binary). |
[in] | size | number of bytes to encode. |
- Returns
- length of string or negative error code.
Definition at line 107 of file Base64.cpp.
int Base64::encode_P |
( |
char * |
dest, |
|
|
const void * |
src, |
|
|
size_t |
size |
|
) |
| |
|
static |
Encode the size number of bytes in the source buffer to a null-terminated printable string in the given destination buffer. The destination buffer must be able to hold the encoded data and the terminating null. A new-line is emitted every 64 characters.
- Parameters
-
[in] | dest | destination buffer pointer (string). |
[in] | src | source buffer pointer (binary, in program memory). |
[in] | size | number of bytes to encode. |
- Returns
- length of string or negative error code.
Definition at line 69 of file Base64.cpp.
Encode the size number of bytes in the source buffer to given iostream device.
- Parameters
-
[in] | dest | output stream device. |
[in] | src | source buffer pointer (binary, in program memory). |
[in] | size | number of bytes to encode. |
- Returns
- length of string or negative error code.
Definition at line 144 of file Base64.cpp.
The documentation for this class was generated from the following files: