|
DeterministicESPAsyncWebServer 1.2.0
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Base64 encoder/decoder. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Functions | |
| void | base64_encode (const uint8_t *src, size_t src_len, char *dst) |
Encode src_len bytes of src as Base64. | |
| size_t | base64_decode (const char *src, uint8_t *dst) |
| Decode a null-terminated Base64 string. | |
Base64 encoder/decoder.
On Arduino (ESP32) targets, delegates to mbedtls_base64_encode/decode() from the ESP-IDF mbedTLS bundle — same SDK path as SHA-1.
On native (x86) test targets, uses a portable software implementation so unit tests run without mbedTLS installed.
Used to encode the SHA-1 digest in the WebSocket handshake response (RFC 6455 §4.2.2) and to decode Basic Auth credentials (RFC 7617).
Definition in file base64.h.
| void base64_encode | ( | const uint8_t * | src, |
| size_t | src_len, | ||
| char * | dst | ||
| ) |
Encode src_len bytes of src as Base64.
Writes a null-terminated string into dst. dst must be at least ((src_len + 2) / 3) * 4 + 1 bytes.
| src | Input bytes. |
| src_len | Number of input bytes. |
| dst | Output buffer (null-terminated Base64 string). |
Definition at line 23 of file base64.cpp.
| size_t base64_decode | ( | const char * | src, |
| uint8_t * | dst | ||
| ) |
Decode a null-terminated Base64 string.
Writes decoded bytes into dst. dst must be at least (strlen(src) / 4) * 3 bytes. Returns the number of decoded bytes. Returns 0 on invalid input.
| src | Null-terminated Base64 input string. |
| dst | Output byte buffer. |
dst, or 0 on error. Definition at line 31 of file base64.cpp.