ESP32 Arduino: Base64 encoding (using crypto/base64 lib)

preview_player
Показать описание
This tutorial explains how to encode a plain text string into base64 format, using the ESP32 and the Arduino core.

**IMPORTANT NOTE**: as indicated in the implementation file of the library, the caller is responsible for freeing the returned buffer with the encoded string. So, although not included in the video, you should call the free function on the returned pointer when you no longer need it.

Related content (written tutorials):

A lot more ESP32 tutorials:

ESP8266 tutorials:
Рекомендации по теме
Комментарии
Автор

Wow, thank you for your video!! I had tried a couple of different libraries but without success. This one works great and is already included in the Arduino Core for ESP32 V1.0.6
To create a String with inside that encoded base64 that you just print on monitor just do this:

Serial.printf("%.*s", outputLength, encoded);

String myFinal = "";
for(int i=0; i<outputLength; i++){
myFinal += String((char)encoded[i]);
}
myFinal.trim();
Serial.println(myFinal);

However if you are using Arduino Core ESP32 V2.0.0 this library does not work. They have simplified it as you see below:


#include "base64.h"

base64 b;
String encoded = b.encode((unsigned char *)data, strlen(data));

merenelresearch
Автор

Hello, thanks for ur video but how to do if we want the user who enters his message via the serial monitor and not via the program ?

perledusavoir
Автор

How encode type FILE? For example file into sd card

lucasstaricklisboa
join shbcf.ru