![]() ![]() Overwriting the file any more then what I've demonstrated here probably would be pointless, (and even my methods are likely overkill).Īs for the language of choice, I find C# to be a reasonable choice, I could have just as easily written it in C/C , but I don't see the boundry in using api, just a little extra work writing the declares. This is due to more accurate read/write heads with no space between tracks, (older dives could leave behind traces of data after an erasure, 'ghosting' due to magnetic drift to the space between tracks). From what I gather most modern drives(>4G) require only a single overwrite to make the data unreadable. With this setting, after the overwrite cycles, the files object identifier is deleted, effectively orphaning the file from the file and security subsystems:Īctually I have read that article in the course of my research for this project. last step: delete the file if (deleteFile(sPath) != true)įor the truly paranoid user, there is a hidden startup switch, ' /p', that enables the paranoid mode. MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) != 0) If (MoveFileExW(sPath, sPartial sNewName, String sPartial = sPath.Substring( 0, sPath.LastIndexOf( \") 1) Private Boolean renameFile( string sPath) IntPtr.Zero, OPEN_EXISTING, WRITE_THROUGH, IntPtr.Zero) IntPtr hFile = CreateFileW(pName, GENERIC_ALL, FILE_SHARE_NONE, The random data phase uses the Crypto API to fill the buffer intended for secure key creation, it also works well in this implementation. The buffers are filled first with zeros, then ones, random data, then zeros again this ensures that even with the most sophisticated software techniques, using a modern hard drive, all data will be rendered permanently unreadable. add it up if ((btWritten dwSeek) = nFileLen) SetFilePointerEx(hFile, 0, IntPtr.Zero, FILE_BEGIN) WriteFile(hFile, pBuffer, (nFileLen - dwSeek), ref btWritten, IntPtr.Zero) ![]() Private Boolean overwriteFile( IntPtr hFile, IntPtr pBuffer) After some initial preamble of file path checks, attribute stripping, and enabling key access tokens within the process, we create the buffer: ![]() The cShredder class is almost completely Win32 driven, using virtual memory buffers and the WriteFile API to overwrite the file with several passes of 0s, 1s, and random data. This time around, however, not being saddled with the limitations of the VB6 language, I was able to create a faster and more thorough application engine. NET language, the reason being that it is a fairly compact and class-driven application. I decided to rewrite the SDS file shredder as one of my first forays into the C#. I originally published v1 in VB6 as 'SDS' on Planet Source Code. Pizza van with tinted windows parked across the road for days? Strange clicking sound on the landline? Crooked CEO maybe? Then this is exactly the tool you have been searching for. This article describes a C style shredder in C#. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |