Skip to main content
3 of 4
added 645 characters in body
Christophe
  • 80.6k
  • 11
  • 132
  • 199

You can very difficultly obtain a true irrecoverable deletion of data. This is not related to algorithms but to physical properties of storage media.

You can only hope to reduce the risk (or opportunity) of the data being recovered. And the risk depends on the means that the recoverer has at its disposals and the value the recovered information has.

A concrete example is hard drives: magnetic remanence creates a risk of undesired traces around the magnetic track. Writing random data several times reduces significantly the risk. However very powerful people having atomic microscopes and plenty of patient skilled staff at their disposal could still recover (at disproportionate costs) some data that you could no longer recover with ordinary reading heads.

Another example are solid state disks, that try to avoid physically overwriting data, to reduce reuse of storage elements. SSD are limited on the number of physical rewrites it can reliably deal with, so they are designed to perform logical rewrites elsewhere whenever possible, to increase their life time. You never really overwrite anything if you just overwrite a single file. You can be sure of an overwrite only if you force the SD to reuse all available space, for example by overwriting the full SSD.

This being said, why trying to write such a program when there is already sdelete. and similar products that were designed by experts in this field?

Christophe
  • 80.6k
  • 11
  • 132
  • 199