Base64
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.
Functions
uint32_t | b64_encoded_size (...) |
uint32_t | b64_decoded_size (...) |
uint32_t | b64_encode (...) |
uint32_t | b64_decode (...) |
String* | b64_encode_from_stm (...) |
String* | b64_encode_from_file (...) |
String* | b64_encode_from_data (...) |
Buffer* | b64_decode_from_str (...) |
Buffer* | b64_decode_from_data (...) |
b64_encoded_size ()
Get the number of bytes needed to encode a memory block in format base64.
uint32_t b64_encoded_size(const uint32_t data_size);
data_size | The original block size. |
Return
Base64 size.
b64_decoded_size ()
Get the number of bytes needed to decode a block of memory in base64 format.
uint32_t b64_decoded_size(const uint32_t data_size);
data_size | The block size encoded in base64. |
Return
The size in bytes.
b64_encode ()
Encode a block of memory in base64.
uint32_t b64_encode(const byte_t *data, const uint32_t size, char_t *base64);
data | The data block. |
size | Block size. |
base64 | The buffer where to store the result. |
Return
The size in bytes.
Remarks
The buffer base64
must be at least the size returned by b64_encoded_size.
b64_decode ()
Decodes a block base64.
uint32_t b64_decode(const char_t *base64, const uint32_t size, byte_t *data);
base64 | The base64 block. |
size | Block size. |
data | The buffer where to store the result. |
Return
The size in bytes.
Remarks
The buffer data
must be at least the size returned by b64_decoded_size.
b64_encode_from_stm ()
Create a base64 with the contents of an input stream.
String* b64_encode_from_stm(Stream *stm);
stm | Input stream. |
Return
Base64 text string.
b64_encode_from_file ()
Create a base64 with the contents of a file.
String* b64_encode_from_file(const char_t *pathname, ferror_t *error);
pathname | File path. |
error | Error code file opening fails. It can be |
Return
Base64 text string.
Remarks
Will return an empty string (not NULL
) if it cannot open the file.
b64_encode_from_data ()
Create a base64 from an in-memory buffer.
String* b64_encode_from_data(const byte_t *data, const uint32_t size);
data | Data block. |
size | Data block size. |
Return
Base64 text string.
b64_decode_from_str ()
Decodes a text in base64.
Buffer* b64_decode_from_str(const String *base64);
base64 | Base64 string. |
Return
Buffer with the result.
b64_decode_from_data ()
Decodes a text in base64.
Buffer* b64_decode_from_data(const byte_t *data, const uint32_t size);
data | Data buffer containing base64 text. |
size | Size in bytes of |
Return
Buffer with the result.