P For Paranoia OR a quick way of overwriting a partition with random-like data

Hacking, Uncategorized
(General Surgeon's warning: The following post contains doses of paranoia which might exceed your recommended daily dosage. Fnord!). A lot of the data sanitisation literature around advises overwriting partitions with random data (btw, SANS Institute research claims that even a pass with /dev/zero is enough to stop MFM but YPMV). So leaving Guttman-like techniques aside, in practice, generation of random data will take a long time in your average system which does not contain a cryptographic accelerator. In order to speed up things, /dev/urandom can be used in lieu of /dev/random, noting that when read, the non-blocking /dev/urandom device will return as many bytes as are requested, even if the entropy pool is depleted . As a result, the result stream is not as cryptographically sound as /dev/random but is…
Read More

Hello world demystified

Hacking, Uncategorized
Hello all, in the finest programming tradition, I take it that every time one took a programming course or decided to have a quick look into a programming language, writing a "Hello World" program was one of the first things done. However, even in such a small program, do you really know what it does behind the scenes? Yiannis blogged about it here, giving a Java test case (and by the way, allow me to extend my welcome!) and Dimitris provided a C equivalent there. However, let's do a roundup. After whacking some Perl code, I got the following results Let's start with the old workhorse, Perl: ################################################################################ The Perl version ################################################################################ strace -c -f -q perl hello.pl % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- ---------…
Read More

CPython threading vs multiprocessing – the 5 minute introduction

Hacking, Uncategorized
MJC brought to my attention the following piece of code which attempts to provide some empirical data comparing the use of threads vs processes in CPython. This code, which I understand that it is stored for historical purposes, has some bugs, which I have pointed out in the comment section, but this is not the point of this article (something like this would be not constructive). I believe that a far better contribution would be to write a short piece attempting to point out a few "gotchas". Bit rot took hold and the post above has disappeared but the rest of the article still applies ... For the rest of this small article, I assume that you are familiar with how threads work in CPython, especially the GIL "issue". If…
Read More