Last time I wrote about files in C#. What occured to me is the fact that you can run out of ram if you want to read really big file. Of course you can process smaller pieces of data at the time (not reading the whole file). But what about encryption? You would have to encrypt small pieces of data to the output file. But let’s say we read and encrypt 10kb at the time, what about decryption? We can’t be sure if the encrypted fragment of data will be also 10kb long. I was thinking about it for some time and I think I found the solution (not really sure though).
I packed it into one small library:
EXAMPLE OF USE:
Crypto.CryptoFile.Encrypt("source.txt", "dest.aes", "your pass", Crypto.CryptoFile.default_salt, Crypto.CryptoFile.default_iterations); Crypto.CryptoFile.Decrypt("dest.aes", "out.txt", "your pass", Crypto.CryptoFile.default_salt, Crypto.CryptoFile.default_iterations);