This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// base64 encoding and decoding example on ESP32 Arudino | |
// using the built-in libb64 libraries | |
// | |
// ~/Documents/Arduino/hardware/espressif/esp32/cores/esp32/libb64/cdecode.h | |
// ~/Documents/Arduino/hardware/espressif/esp32/cores/esp32/libb64/cencode.h | |
#include "libb64/cdecode.h" | |
#include "libb64/cencode.h" | |
void setup() { | |
const char* msg = "Hello World"; | |
// encode | |
char encstr[base64_encode_expected_len(strlen(msg))]; | |
int enclen = base64_encode_chars(msg, strlen(msg), encstr); | |
printf("Encoded: %s\n", encstr); | |
// decode | |
char decstr[base64_decode_expected_len(strlen(encstr))]; | |
int declen = base64_decode_chars(encstr, strlen(encstr), decstr); | |
printf("Decoded: %s\n", decstr); | |
} | |
void loop() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment