Go Down

Topic: Encryption with arduino board (Read 10730 times) previous topic - next topic


Hi guys.

Is it possible to create a sketch running on Arduino for data encryption?

Thanks, have a nice day


Sure it's possible, but the ATMEGA168 (on the diecimila at least) is only 16Mhz, so encrypting anything with a "modern" algorithm (AES, RSA) will take at least a few seconds, depending entirely on key length, rounds used, string to encrypt/decrypt, etc.

Plus the diecimila only has 512bytes of memory, which must include storage space for the variables used to decode the encrypted string (or encode the plaintext string), so you're going to be limited to probably 256 bytes at most (two SMS messages worth of text).
Plus you need storage space for the key, an means to input and output the messages and possibly the keys.

I'd recommend a more powerful device for doing cryptography personally, but you could easily use an arduino for Classical cryptography - Vigenere ciphers and Shift/Substitution ciphers for example. These require very little computation as they are character-based - they were essentially around just before computers could decode them.


Oh Tim, thanks so much for answering!

Have a nice day!


Ok, but arduino board operate at 16 bit or 32 bit?



The arduino uses an 8 bit CPU.

What is it you wanted the arduino to do?


Dec 08, 2008, 10:14 am Last Edit: Dec 08, 2008, 10:18 am by ard10000 Reason: 1
Thanks, I'd like to develop the Elliptic Curve algorithm.

detalis here: http://www.shamus.ie/

I believe that is not possibile...just 8 bit cpu.

What do you think?


ECC is one of the most complex AND computationally intensive encryption routines, due to the nature of Elliptic Curves. ECC is based upon solving the discreet logarithm problem and that in itself requires a very high level of knowledge of mathematics.

I'd recommend strongly that you try something simpler first, or implement what you're trying to do in 16 or 32-bit on a normal PC architecture and then convert it to 8 bit for the Arduino.
If you haven't written cryptography algorithms before I would be very impressed if you manage to pull this off within 12 months with an Arduino.

Sorry to put a downer on this idea, but you have to start small and work your way up - jumping in at the deep end and drowning is the best way to put someone off swimming.

If you're determined to do this, try implementing first ElGamal encryption, or the Digital Signature Algorithm (DSA), which both use discreet logarithms.

- Tim



I believe that is not possibile...just 8 bit cpu.

The number of bits in a CPU is totally irrelevant as regards to actually doing a problem. You might be defeated by the amount of memory it takes or the speed in which you can complete it but doability is not a function of CPU data bus width.


Plus the diecimila only has 512bytes of memory

FWIW just to be pedantic it's actually 1024 bytes of RAM. There's 512 bytes of EEPROM.



Try twofish. It was designed to be implemented on 8-bit hardware, and needs only 36 bytes of RAM (if the key is stored in EEPROM).

Try this search for more info.


Try twofish.

I looked at the C code to implement it.  Just guessing from my short peek at it, but the code itself might fill the whole ATmega168 and more.  I will see what parts really need to be there.  It would be kinda fun to make an "Ardufish device," huh?

Go Up