
This is needed to decrypt the data later on in my webserver. I already managed to encrypt my data, by using the AESLib.h library. This will be transferred to my raspberry PI but this data needs to be send encrypted. Serial.printf (" ASCII: \nLen: %d\n\n", ASCII.c_str(), ASCII.I am using my arduino UNO to generate location data. Return bc.StringFromBytes(byteOut, "ISO-8859-1") Sub XorMessage2 (Text As String, Key As String) As String Sub XorMessage1 (Text As String, Key As String) As String

Log("Decrypted: Len: " & Decrypted.Length) Log("Encrypted: Len: " & Encrypted.Length)ĭecrypted = XorMessage(Encrypted, ENCRYPTION_KEY) Log(" Original: Len: " & original.Length)Įncrypted = XorMessage(original, ENCRYPTION_KEY) ' Dim original As String = "Lettere: abcdefghilmnopqrstuvzxyj ABCDEFGHILMNOPQRSTUVZXYJ Numeri: 0123456789 Caratteri: !?è+òàù=()È+ÒÀÙ+-()fine" On ESP8266 with CPU clocked 160Mhz it require about 3 microseconds every character to encrypt/decrypt, so very fast too.ĭim original As String = "Questa è una stringa relativamente lunga da usare come test per l'algoritmo di encrypt: Numeri: 0123456789 Caratteri: !?è+òàù=()È+ÒÀÙ+-()fine" This function is pretty fast too, it encrypt/decrypt about 3.500.000 characters every second on my old Dualcore PC, but won't work between different platforms. Note that because I use XOR there are no function to Encrypt and function to Decrypt, just call the function will encrypt the string, calling it again will decrypt.

B4A ESP8266, as already explained, sometime work and sometime not. The same work well from ESP8266 to another ESP8266 or ESP32 or dencrypt/decrypt on the same sketch.īut when I try it between different platforms eg.

The algorithm work well from Android to Android using B4A, I even tried it on B4J and seem to work well too. Some strings are decrypted good and some others are incomplete and/or not correct decrypted. I've found a lots of problems because different characters encoding UTF8 vs ASCII (or extended ASCII). This worked well between my Android SmartPhone and Raspberry (B4A B4J), but now that I converted the server side to run on ESP8266 (In C++ on Arduino IDE) instead of Raspberry it won't work correctly.

For my 3D printing host app I need to encrypt some data while send over network, then decrypt on server side that receive over the network and send to the 3D Printer over USB.įor this purpose I've used a Raspberry PI Zero W that acts as WiFi-Serial bridge to remotely control a 3D printer.īecause I had necessity to adapt to ESP8266 and ESP32 (instead of Raspberry), I never used B4XEncryption and tried to use a sort of simple algorithm XORing all strings I send.
