Need help with encryption for an arduino project

I am creating an Arduino project using two ESP8266 and two loras SX1278 to create a communication channel between the two ESP8266. I would like to secure the communication by including an encryption library to the code, however, I am a beginner in this matter. Therefore, in this case, what encryption algorithm is recommended? (I was thinking of AES or SHA but I am not sure which one is suitable for the project) and also I need guidance on how to integrate it in the code I am working on which is the following: (The two ESP8266 have the same code)

#include <SPI.h>
#include <LoRa.h>

String outgoing;

void setup(){
  Serial.begin(9600);
  LoRa.setPins(15,16,4);
  LoRa.begin(433E6);
  Serial.println("LoRaChat");
}

void loop(){
  while(Serial.available()==0){
    int packetSize=LoRa.parsePacket();
    if (packetSize){
      while(LoRa.available()){
        Serial.print((char)LoRa.read());
      }
      Serial.print("");
    }
    delay(10);
  }
outgoing=Serial.readString();
Serial.print(" My Station: ");
Serial.println(outgoing);

LoRa.beginPacket();
LoRa.print(outgoing);
LoRa.endPacket();
}

Thank you!

There are several encryption libraries for Arduino. The search phrase "arduino encryption library" will find them.

Start with the library examples to learn how to use them and integrate them into your code.

Thank you!
I have searched about encryption libraries, but I am not sure which one is suitable for the project and how to integrate it in the code.

You have to define what is "suitable". Forum members can't do that for you.

Pick one and follow the library examples to get started. They all work (or should work) if used properly, but none are certified to be cryptographically secure, by any modern definition.

As you learn how to use the libraries, you will gain a better idea of what might be best for your project.

1 Like

Perhaps describe the actual project, how much data you are sending, how often, and why you need encryption.

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

Expert or novice, research is the first action:
ESP8266 Arduino Encryption at DuckDuckGo

Is there "really" any good reason to encrypt the data or are you just wanting to do so? Encryption takes energy and is almost always unnecessary, especially when battery operation is needed.

Often a simple obfuscation algorithm can be used rather than true encryption. Project builders should concern themselves with physical device security as having ones weather station stolen is more likely than a neighbor listening-in on your windspeed and temperature.

I have used Speck encryption because it can be very lightweight on processing requirements. It's not an extremely secure code, just "good enough" and that is what it was designed for.

https://github.com/rweather/arduinolibs/tree/master/libraries

I am not sure which one is suitable for the project and how to integrate it in the code

It's sort of like, "I'm not sure what tool I need to do some work, and how to use it", without saying what the work is.

That's the question. What are the chances someone is really out there with nefarious intentions of snooping on your little Arduino project? Why would they care? Why would they bother? Or is this just in case your tin foil hat falls off?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.