Cat's Meow from the Offner Dynograph EEG

What will you bitflip today?

I want to let you into a secret: I enjoy corruption. Corrupting digital objects leads to undefined behavior (C++’s definition is fun). And flipping bits in objects can tell us something both about the fragility, and robustness of our digital files and the applications that work with them.

I had a pull-request for bitflip accepted the other day. Bitflip is by Antoine Grondin and is a simple utility for flipping bits in digital files. I wrote in my COPTR entry for it that it reminds me of shotGun by Manfred Thaller. The utility is exceptionally easy to use (and of course update and maintain written in Golang) and has some nice features for flipping individual bits or a uniform percentage of bits across a digital file.

My pull-request was a simple one updating Goreleaser and its GitHub workflow to provide binaries for Windows and FreeBSD. I only needed to use Windows for a short amount of time thankfully, but it’s an environment I believe is prevalent for a lot of digital preservationists in corporate IT environments.

Bitflip is a useful utility to improve your testing of digital preservation systems, or simply for outreach, but let’s have a quick look at it in action.

To infidelity and beyond

As you know, I previously harnessed the effects of bitrot in my game Nibble in Cyberspace. In that same blog I mentioned some outreach work I did using bitflip at Ravensburger AG to demonstrate the effects of bitrot on an old Spinnaker computer game called Weltraumkolonie.

I had previously used bitflipping techniques in my interview for Ravensburger and then again for a whole of company presentation later in the year 2021 but I needed a reliable tool for my own bitflipping experiments and bitflip became my goto.

An example of bitrot using the Ravensburger mobile games logo, the image is split into four quadrants and demonstrates the different visual artefacts and color changes that result from the degradation of a bytestream.

I found that I liked to use the tool’sΒ spray command which allows you to flip multiple bits in a file for a given number of bytes using a uniform distribution. An example spray command might look like:

bitflip spray percent:0.001 file-to-corrupt.jpg

This command will corrupt 0.001 percent of a digital file. You can increase or decrease the percentages as required.

It turns out, 0.001 percent really is enough to mean the difference between an object rendering and an object not.

Corrupt JPEG in Image Magick's display utility

TIp: check out PNG for even greater fragility!

0.001% seems a fairly arbitrary amount but I worked backwards from a higher number until I had more success corrupting objects while maintaining some of their “fidelity” i.e. ability to open.

With an affinity for visual noise, I of course gravitate toward images, and so I took one of my favorite JPEGs saved from around the internet (it’s often one of the first images in test corupi that I write) and started corrupting away.

Cat's meow from the Offner Dynograph animated based on contiguous attempts at corrupting the image using bitflip

I ran the spray command iteratively on the Cat’s Meow. I took each result that would continue to render successfully and turned them into frames for an animation until images could no longer be rendered. The result was about 19 frames and combined we see the effects of decreasing file integrity with the image slowly disappearing on us, but also, the introduction of interesting visual elements, from the pseudo-movement of the cat through the frame, and if you pay attention to the sound wave it also starts to move through space as if actually echoing. I also like the ghostly artefacts of the different objects in the bitmap.

A montage of images of the Cat's Meow corrupted contiguously using Bitflip

Decreasingly analog or increasingly digital?

How likely we are to see bitrot in the wild today I don’t know. The concept is a little harder to grasp with more complex digital storage and tooling. While not necessarily a mythological problem, documented cases are hard to come by. I suspect it was more likely when we had media such as floppy disks where their natural (as in nature) physical properties could degrade with time, e.g. their magnetic resonance.

Clever folks in the field doing more with floppy disks than I am will see this more regularly and have cool visuals to support their analysis, check out this blog and visual from Leontien Talboom.

Example visualization of a floppy disk image in GreaseWeazle via Leontien's blog at Cambridge University Libraries
By Leontien Talboom via https://digitalpreservation-blog.lib.cam.ac.uk/raw-flux-streams-and-obscure-formats-further-work-around-imaging-5-25-inch-floppy-disks-5a2cf2e5f0d1

I was working with floppies once, and did think that I saw bitrot in real-life but it turned out to be the way Wordstar represented word boundaries or other formatting directives!

And fortunately, for the day-to-day work in archives, digital preservation is built around numerous strategies to control against bitrot – a checksum at the earliest point of control of a digital object is probably one of the single biggest pieces of information we can generate to help maintain integrity and prove authenticity.

Via https://x.com/beet_keeper/status/1121096820518682628

What will you bitflip today?

bitflip (the tool) on the other hand allows us to experience bitflip and bitrot for real with our everyday commodity file formats in the safety of our own laboratories. Maybe you’ll take inspiration from Antoine, and this blog, and try it out on some of your favourite files, maybe an audio file (would WAV work better than FLAC or MP3?) or maybe even some of your executables; maybe the bitflip binary itself?! Share your results, especially if they’re interesting! What will you bitflip today?Β 

A quick note on COPTR and GitHub actions

COPTR might be changing

Andy Jackson has posted an important post on the future of COPTR here. I have shared my thoughts there with a request to try and decouple some of the problems expressed, to focus on COPTR as an important registry in its own right; but please do take the time to read Andy’s comments and chime in with your thoughts, especially, as if like I do, you find COPTR to be an invaluable resource.

GitHub actions

If like me you find GitHub actions to be a dark art that is hard to grasp, checkout this GitHub action playground, it has helped me more than a few times to iron out issues in the past year, and it might help you too.

 

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow

Get every new post delivered to your Inbox

Join other followers: