When thinking of encrypting a file (also how I implemented it in a program of mine), I think of getting the data of a file, encrypting it, and writing it back into the file (overwriting the file).

But actually, is that the usual way of encrypting a file?

Since when securely deleting files, there is also the option to overwrite the data at the memory address of the file multiple times.

  • Overwriting is a good option but useless on SSDs (flash based media).
    – Robert
    Nov 28, 2021 at 20:33
  • You need to make sure it actually overwrites the original blocks, rather than writing the new (encrypted) version in a different place. This'll depend on both the filesystem (copy-on-write filesystems always write the new contents in a different place) and physical storage (flash storage uses copy-on-write at the physical layer). Nov 28, 2021 at 20:48
  • so on windows, with a HDD, overwriting the file is fine? While on windows with an ssd, is not?
    – Dahlin
    Nov 28, 2021 at 20:54
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Nov 29, 2021 at 2:16


You must log in to answer this question.

Browse other questions tagged .