Securely erasing a file

Talk about any languages right here. Share and discuss source, but don't expect your homework to be done for you.

Securely erasing a file

Postby moghedien » Tue Mar 29, 2011 12:39 am

So I am trying to write a function, in C, that will securely erase a file. Here is my general procedure:
- Open the file for reading and writing
- Overwrite the file a specified number of times with random data, flushing the file with flush() after each iteration
- Deleting the file using remove()

If a file is overwritten, say 10 times, in this manner will it be securely erased or not??
moghedien
n00b
 
Posts: 4
Joined: Mon Mar 28, 2011 12:59 am

Re: Securely erasing a file

Postby Cool_Fire » Tue Mar 29, 2011 3:21 am

That's in interesting approach to secure erase. If it'd work would depend on your filesystem, as some write data to a different location when it's being overwritten. This is why such secure delete functions usually write directly to the sectors on the drive where the file is located.
If we're breaking the rules, then how come you can't catch us? You can't find us? I know why. Cause, it's ... MAGIC!

Hackerthreads chat, where the party is going 24/7.
User avatar
Cool_Fire
Not a sandwich
 
Posts: 1558
Joined: Fri May 09, 2003 1:20 pm
Location: 41 6d 73 74 65 72 64 61 6d

Re: Securely erasing a file

Postby moghedien » Tue Mar 29, 2011 9:38 am

I had a feeling the strategy was a little too simple. I got the idea looking at the source code for an open-source utility that claimed to securely erased files. So I decided to try it out, but didn't really have a way to test it.
moghedien
n00b
 
Posts: 4
Joined: Mon Mar 28, 2011 12:59 am

Re: Securely erasing a file

Postby moghedien » Tue Mar 29, 2011 9:46 am

moghedien wrote:I had a feeling the strategy was a little too simple. I got the idea looking at the source code for an open-source utility that claimed to securely erased files. So I decided to try it out, but didn't really have a way to test it.


Does anyone know of some open source code, that properly securely erases a file, that I could take a look at??
moghedien
n00b
 
Posts: 4
Joined: Mon Mar 28, 2011 12:59 am

Re: Securely erasing a file

Postby Tech_Junkie » Tue Mar 29, 2011 12:14 pm

I believe this works.

http://eraser.heidi.ie/
User avatar
Tech_Junkie
Your Senior
 
Posts: 871
Joined: Wed Apr 14, 2004 8:07 pm

Re: Securely erasing a file

Postby moghedien » Tue Mar 29, 2011 7:41 pm

Thanks! I'll check that out.
moghedien
n00b
 
Posts: 4
Joined: Mon Mar 28, 2011 12:59 am


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron