sweety said:
Dear All,
How to encrypt a C data file
Putting the word "C" into an article doesn't make it topical in comp.lang.c!
and make binary file and then have to read
a bin file at run time and decrypt the file and have to read the data.
The answer to this question depends on your threat model, and on the balance
you are prepared to strike between performance, security, and key
distribution, and on your skill level with C, and so on and so forth.
If you want something that'll stop a major government from reading your
data, you'd be well-advised to use a well-analysed algorithm such as
Rijndael (AES) or TwoFish.
If you just want something that'll stop your kid sister from reading your
data, a simple Feistel network in CBC mode with a primitive round function
based on a 64-bit key is probably sufficient.
Caveat: if your kid sister works for a major government in a cryptology
capacity, go for the first option, not the second.
I recommend "Applied Cryptography", 2nd edition, by Bruce Schneier, or
"Handbook of Applied Cryptography" (legally available online for free, from
<
http://www.cacr.math.uwaterloo.ca/hac/> for some useful insights into
designing cryptographical algorithms - but please remember that no
algorithm you can design yourself is going to give a clueful user the same
"feel safe" factor as a properly-analysed algorithm designed by experts.