hey all--

I'm getting ready to format one of my drives as there are two more linux distributions I'd like to try out (inspired by a CB discussion yesterday). This sparked a memory of a section in Neal Stephenson's Cryptonomicon where the main modern-day character, Randy, attempts to completely wipe a disc containing some sensitive data in such a way as to ensure that nothing can be recovered from it. It's one of the more intense hacker-ly (possibly cracker-ly, though the files he was getting at were his own) sequences, and at the time I remember wondering what the best way to do that sort of thing would be. Since about May I've been assuming that the best way (or even several of the best ways) to do just about anything involve perl.

Now that I'm reformatting anyway, and since I'm currently perl-crazy, I'm curious: how could the task Randy attempted be accomplished in perl? I don't have the book with me, but as I remember it, the two main things he tried to do were to:

  • delete all mail files and any file that contained certain names (had to do this first as time was an issue and he didn't know if the second process would finish)
  • go through the drive block by block and overwrite each one seven times with random bits
  • The first part isn't really interesting to me... all I really want to know is if perl can be used to make something as simple as cleaning an old disk a sexy process. I believe the character in the book did this with a bunch of unix commands, but he probably wrote a lot more lines of code than one of you perl gurus would have. anyone got a one-liner to wipe a partition and cover it with junk til the data's unrecoverable? out of idle curiosity, is there a better/more secure perl way to do this than the one employed in the book? regardless of the answer, I'll just end up writing a new file system over it anyway.

    yes, this is how bored I happen to be :D
    --au

    I suppose I ought to include some disclaimer about how you all shouldn't bother responding if this sort of code seems likely to get people into trouble or to be abused, but I also suppose you all would have used your own good judgment even had I not said a thing. thanks for any appropriate responses :) If this doesn't get answered I'm certainly not sweating it, I'll just cfdisk like everyone else


    In reply to cryptonomicon challenge by aufrank

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.