1

I have an embedded device. It produces larges files (200 MB). I want the device to encrypt the file before writing to disk, so I gave them all a 16-byte random key.

How can I transform the large file with the small key, with the least amount of CPU?

If I XOR the data with the 16byte key, its almost good enough. But it will show repeated patterns from which you can distract the key (for example if the input is 16 zeroes), but can I make it better without sacrificing on performance?

AES on my device

Maestro
  • 1,069
  • 1
  • 10
  • 17

2 Answers2

1

Use AES-128, the instruction set in most CPU's (AES-NI) speeds up the encryption and does not put to much load on your CPU. I would use CBC but there might be better mode operations for encrypting files. Also don't forget to use a MAC.

Using a one time pad (OTP) is nice but what you're doing is not an OTP it's more a Vigenère cipher. If you were to use OTP the key should be as long as the file which requires you to store a (approximately) 200MB key.

Thanks @CodesInChaos I missed the "I have an embedded device", but than it's not a CPU it's a MCU (most likely) even than, AES is designed to be fast on any platform so i would still give it a try, just see how much it takes i think you'll be surprised as to it's efficiency.

Take a look at the list of validated AES implementations, see if there's something which resembles your embedded device.

Vincent
  • 976
  • 2
  • 12
  • 30
-2

In your case I'd recommend you to try TripleDES, maybe with a paired ARM MCU - it's cheap and fast enough... Try to take a look at STM chips, I used them before and I have a very good recommendations due to price/perfomance. Also you can try to implement DES physically if you have a hi-speed requirement in your device's spec list.

Alexey Vesnin
  • 226
  • 5
  • 8