[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default number of overwrites in shred

From: HggdH
Subject: Re: Default number of overwrites in shred
Date: Sun, 25 Jan 2009 21:25:05 -0600

On Mon, 2009-01-26 at 02:20 +0000, Pádraig Brady wrote:
> > A consequence of this change -- right now -- is that all 3 passes
> will
> > be random. I am not sure if this was the intended result or not.
> Yes we don't really care about the patterns written to file any more,
> so random is as good as any. Attached is a test to make this explicit.
> cheers,
> Pádraig.

Thanks, Pádraig.

One more thing -- and please forgive me on insisting on this --: the
random passes are done by using /dev/urandom, not by randomly selecting
possible patterns from the passes table.

I did a quick & dirty test (and I am not suggesting this to be
implemented, it was just to check), taking out two of the 'random'
entries in the table. I then ran GIT shred, and my modified shred. This
is what I get:

address@hidden:/tmp $ time shred --verbose test1.data
shred: test1.data: pass 1/3 (random)...
shred: test1.data: pass 2/3 (random)...
shred: test1.data: pass 3/3 (random)...

real    0m5.761s
user    0m0.016s
sys     0m5.480s
address@hidden:/tmp $ time /usr/src/buildd/coreutils-git/src/shred
--verbose test1.data
/usr/src/buildd/coreutils-git/src/shred: test1.data: pass 1/3
/usr/src/buildd/coreutils-git/src/shred: test1.data: pass 2/3
/usr/src/buildd/coreutils-git/src/shred: test1.data: pass 3/3

real    0m2.430s
user    0m0.020s
sys     0m2.020s
address@hidden:/tmp $ ls -l test1.data
-rw-r--r-- 1 hggdh hggdh 4239360 2009-01-25 21:15 test1.data
address@hidden:/tmp $

This is the change I did for the test:

address@hidden:/usr/src/buildd/coreutils-git $ git diff
diff --git a/src/shred.c b/src/shred.c
index 6ed4daa..d087c67 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -623,10 +623,10 @@ dopass (int fd, char const *qname, off_t *sizep,
int type,
 static int const
   patterns[] =
-  -2,                          /* 2 random passes */
+  /* -2, */                    /* 2 random passes */
   2, 0x000, 0xFFF,             /* 1-bit */
   2, 0x555, 0xAAA,             /* 2-bit */
-  -1,                          /* 1 random pass */
+  /* -1, */                    /* 1 random pass */
   6, 0x249, 0x492, 0x6DB, 0x924, 0xB6D, 0xDB6, /* 3-bit */
   12, 0x111, 0x222, 0x333, 0x444, 0x666, 0x777,
   0x888, 0x999, 0xBBB, 0xCCC, 0xDDD, 0xEEE,    /* 4-bit */
address@hidden:/usr/src/buildd/coreutils-git $ 

May I suggest this to be revisited? If we do not care what type of
passes we do, then we could just pick three out of all possible passes,
and not force-feed random at least three times.

This would make shred usable on extremely large files, or on a whole



Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]