I want to encrypt a text file in Delphi & decrypt it, line by line, in C on an embedded system which does not have much RAM (so, only one line in RAM at a time).

FOSS must be available for both Delphi & C; nothign too huge, preferably a single file for each. No messing about wth key files, the kay & salt will be hard coded into the applciatioon.

I am seeking "just good enough" "security through obscurity". Enough to deter a causual hacker. The actual embedded device will be behind a physical lock & key.

[Verdict] I will go with either TEA or AES (tbd). I will split the functionality into two parts: 1) decrypt into a plain text file, 2) parse that as an INI file and if I hit memory problems then change to a line_1=data_1, line_2=data_2 format.

Thanks for your help.


Symmetric-key encryption is very light weight, I am not sure why memory/cpu this would be a concern, even on a cheap micro-controller. Perhaps 30 years ago this was a worry, but not in twenty-twelve.

I like AES-128 in CCM mode with a random IV. If you don't know what that means, you probably shouldn't be implementing a crypto system. Encryption isn't some magic wand that protects you from attack, a lot can go wrong. Good cryptographers are hard to come by.

  • 2
    AES is standard, open, well-described, and available in enough libraries to make one blue in the face enumerating them for both Delphi and C. – Jeff Ferland Nov 7 '12 at 5:53

Use GPG. Don't roll your own! If you try to implement your own crypto, odds are good you will get something wrong.

If you are really, truly hardcoding the key in the application, I hope you realize that this is thoroughly insecure. It's basically just security theater. If that's what you want, have you considered ROT13?

  • +1 Thanks, but security theatre is enough in this case ;-) – Mawg Nov 7 '12 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.