Shortest code to secure wipe a disk Let's write the shortest code to perform a simplified variant of the DoD 5220.22-M Wipe Method with only two writing passes.

Any programming language accepted, but the use of disk-wiping-oriented libraries is prohibited.

Here's how we are to implement it in pseudocode:

Set x to 0

[Start]
'Write Pass
For each sector in disk write the content of x
'Verification Pass
For each sector in disk {
    If sector does not contain the content of x then goto [Start]
}
'Check whether we already did the pass with 1
If x is not 1 then {
    Set x to 1
    GoTo [Start]
}
Else end


In other words, this code will run twice, with a write pass and verification pass for 0, and a write pass and verification pass for 1.

Anyone ballsy enough to implement it code-golf style? ;)
On a linux system there's no need for special handling of devices. Just use the device file interface.
Python 3 (byte strings) - 141 bytes
d=input()
f=open(d,'r+b')
z=f.seek
z(0,2)
s=f.tell()
i=0
while i&lt;2:
 z(0);f.write([b'\0',b'\xff'][i]*s);f.flush();z(0)
 if f.read()==x:i+=1

It's fairly straightforward, and not really optimised heavily, but it works. Here's a basic rundown.

Get input (device file path)
Open device file
Seek to the end, get filesize (block devices are always their real size)
enter write-and-check loop
construct 0-bit and 1-bit strings (x)
write bitstring
flush output (I could have set buffering=0 but this is shorter)
test file against x, and increment step of loop if it passes

exit loop when the increment is high enough
As a bonus, you could modify this for any set and number of byte-modification patterns, like 0x55/0xaa for stronger overwriting effects.
I did actually test this on a device file, using loopback. However, I'm not 100% sure the checking actually works. It might be necessary to close and reopen the file each pass, due to buffering behaviors. I would hope flush prevents this.
*edited to incorporate some suggestions in the comments