How can I encrypt the codes I have written?

As an example,

I used arduino for a project, and now my codes will upload to about 80 arduinos.

"uploading codes to arduino" job will not done by me, it will done by somebody else... So, I do not want to share my program with open codes. Is there any way to share them in binary or hex format or anyother way?

thanks.

Just give them the hex file.

To find the hex file, turn on verbose compile messages in Preferences. The .hex file will be the last thing before the "Sketch uses 4,154 bytes (14%) of program storage space" message. In my case it was: "/var/folders/cs/p6yz0z1m8xj9lf0059b_lzw00000gn/T/arduino_build_318773/BlinkWithoutDelay.ino.hex"

The uploader will need to use the 'avrdude' program to upload the .hex file. You can also use that program to disable the reading of FLASH through the programming interface so nobody can copy your .hex file from the AVR processor.

1 Like

If using any recent version of the Arduino IDE you can also do:

  • Sketch > Export compiled Binaryu
  • Sketch > Show Sketch Folder

maybe a bit more user friendly, though learning how to find the build folder is very useful in itself.

1 Like

How can I encode the Arduino code and not give it to someone else?

How did the hex coil work?

Hex code is what is actually sent to the Arduino during upload with the serial connection.

It is the machine code translation of the C/C++ code that you write, and is incomprehensible to most people.

Looks something like this:
:020000040000FA
:020000000C28CA
:10000800FE00030EF1000408F2000A08F300C829F4
:100018000D2883133F30FD000130FE00F630FF004D
:10002800203084001922F701F801F9018301AF2873
:1000380083120313CD01CD0A0A30C6000030C70071

To produce the hex file, In the Arduino IDE, chose sketch > upload or sketch > export compiled binary. See post above to find the output file.

If you have any secret code, and you want to deliver the program to other clients, you can use this tool PravySoft Arduino Program Encrypter and Burner (https://pravysoft.org/blog/2021/01/07/arduino-program-encrypter-and-burner/).

It will automatically detect the hex file and it also encrypts that file.

1 Like

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