How do I do "wipe" in WinNT

Wesley J Landaker
Tue, 31 Oct 2000 00:04:05 -0700

Hash: SHA1

On Monday 30 October 2000  8:05pm, Kevin Hung wrote:

> I am using GNUPG in WinNT at work (I know that this is
> not the favorite OS for GNU people but I don't have a
> choice) and I would like to have the "wipe" feature as
> availabe in PGP or the shred command in Linux. Is
> there any similar thing like shred in NT? Thanks.
If there's not already something that does that in Windows from the command line (I know some gui utilities that do it, and of course PGP does--but this assuming you're not using PGP), this should do the trick (this does exactly what most utilities like shred do--overwrite with '1's, '0's, and random bytes. Of course, you need a better random source than "rand()" usually, but this should probably be okay anyway--heck, we're using 50 iterations!!!) #include <stdio.h> #include <stdlib.h> #include <time.h> void do_shredding(const char file[]); int main(int argc, char *argv[]) { if (argc < 2) { printf("Cheapskate-shred -- this will shred files as good as anything else...\n"); printf("Usage: %s <file> ...\n",argv[0]); return 1; } for (int i=1;i<argc;i++) { do_shredding(argv[i]); } return 0; } void do_shredding(const char file[]) { const char ones = 0xff; const char zeros = 0x00; char random; FILE *shred_me = fopen(file,"r+b"); fseek(shred_me,0,SEEK_END); int file_len = ftell(shred_me); time_t t; srand(time(&t)); // do this for 50 iterations -- plenty, probably for (int iter=0;iter<50;iter++) { // first write 1's rewind(shred_me); for (int i=0;i<file_len;i++) { fwrite(&ones,1,1,shred_me); } // then write 0's rewind(shred_me); for (int i=0;i<file_len;i++) { fwrite(&zeros,1,1,shred_me); } // then (probably pseudo-) random bytes rewind(shred_me); for (int i=0;i<file_len;i++) { random = rand(); fwrite(&random,1,1,shred_me); } } } - -- Wesley J. Landaker - ICQ# 17241646 PGP DSS/DH Key: 0x0F338E07 PGPKey FP: 3AAA 424B B488 198E B68B C0E5 390A BACA 0F33 8E07 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: See or to obtain PGP software iEYEARECAAYFAjn+bukACgkQOQq6yg8zjge8IACfcTtTZElWBPrzxXpPaNwKrEgW ml8An0huNdKM1OVewSoE7gIRTCGUFb/oiEYEARECAAYFAjn+bukACgkQOQq6yg8z jge8IACgxQi8fiCchg3Dbyr9lsHhem+EG/kAnRa/aKOYkLYS2dz1G4+YKO2WtjNz =aMYj -----END PGP SIGNATURE----- -- Archive is at - Unsubscribe by sending mail with a subject of "unsubscribe" to