The Poetics of Empire

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

The Poetics of Empire (Lewton Bus)

Pop quiz: In your typical James Bond movie, who is the protagonist?
Seems like a strange, obvious question, right? It’s obviously Bond. He’s the hero. He’s played by the top-billed actor. The franchise is basically named after him. So, clearly, Bond is the protagonist. Right?
Put a pin in that…

Bond, Thanos, Palpatine, Thespis

Pop quiz: In your typical James Bond movie, who is the protagonist?

Seems like a strange, obvious question, right? It’s obviously Bond. He’s the hero. He’s played by the top-billed actor. The franchise is basically named after him. So, clearly, Bond is the protagonist. Right?

Put a pin in that, and we’ll come back to it.

Now, here’s a similar question: In the new Avengers: Infinity War, who is the protagonist?

This article mirrors almost-exactly the conversation that Ruth and I had coming out of the cimena after seeing Infinity War the other week.

Daft Lego

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

YouTube (youtube.com)

You’ve seen Daft Punk music videos before. You’ve seen remixes of Daft Punk music videos before. You’ve seen Lego remixes of Daft Punk music videos before. But you haven’t seen anything like this before (unless you’ve seen this before).

Orkambi Protests, 22nd June 2018, Belfast and London

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

Orkambi Protests, 22nd June 2018, Belfast and London (Little Fierce One)

www.youtube.com/watch This video was made to raise awareness about the campaign to make a life saving cystic fibrosis medicine available on the NHS. Please share far and wide and go to a protest in…

https://www.youtube.com/watch?v=oVCZqWu5_Lk

This video was made to raise awareness about the campaign to make a life saving cystic fibrosis medicine available on the NHS. Please share far and wide and go to a protest in Belfast or London on 22nd June if you can! Thanks to everyone who contributed to the video and huge thanks to…

GIF MD5 hashquine

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

GIF MD5 hashquine – Rogdham (rogdham.net)

TL;DR: Quick access to GIF MD5 hasquine ressources:

Introduction

A few days ago, Ange Albertini retweteed an tweet from 2013 asking for a document that shows its own MD5 or SHA1 hash.

Later, he named such a document an hashquine, which seems to be appropriate: in computing, a quine is a program that prints its own source code when run.

Now, creating a program that prints its own hash is not that difficult, as several ways can be used to retrieve its source code before computing the hash (the second method does not work for compiled programs):

  • Reading its source or compiled code (e.g. from disk);
  • Using the same technique as in a quine to get the source code.

However, conventional documents such as images are likely not to be Turing-complete, so computing their hash is not possible directly. Instead, it is possible to leverage hash collisions to perform the trick.

This is the method that I used to create the following GIF MD5 hashquine:

hashquine and md5sum

Once I managed to do create it, I figured out that it was not the first GIF MD5 hashquine ever made, since spq beat me to it.

I will take that opportunity to look at how that one was done, and highlight the differences.

Finally, my code is on Github, so if you want to create your own gif md5 hashquine, you could easily start from there!

Creating a GIF MD5 hashquine

To create the hasquine, the two following ressources were used exhaustively:

A note about MD5 collisions

We say that MD5 is obsolete because one of the properties of a cryptographic hash function is that it should not be possible to find two messages with the same hash.

Today, two practical attacks can be performed on MD5:

  1. Given a prefix P, find two messages M1 and M2 such as md5(P || M1) and md5(P || M2) are equal (|| denotes concatenation);
  2. Given two prefixes P1 and P2, find two messages M1 and M2 such as md5(M1 || P1) and md5(M2 || P2) are equal.

To the best of my knowledge, attack 1 needs a few seconds on a regular computer, whereas attack 2 needs a greater deal of ressources (especially, time). We will use attack 1 in the following.

Please also note that we are not able (yet), given a MD5 hash H, to find a message M such as md5(M) is H. So creating a GIF displaying a fixed MD5 hash and then bruteforcing some bytes to append at the end until the MD5 is the one displayed is not possible.

Overview

The GIF file format does not allow to perform arbitrary computations. So we can not ask the software used to display the image to compute the MD5. Instead, we will rely on MD5 collisions.

First, we will create an animated GIF. The first frame is not interesting, since it’s only displaying the background. The second frame will display a 0 at the position of the first character of the hash. The third frame will display a 1 at that same position. And so on and so forth.

In other words, we will have a GIF file that displays all 16 possibles characters for each single character of the MD5 “output”.

If we allow the GIF to loop, it would look like this:

GIF showing all possible MD5 characters

Now, the idea is, for each character, to comment out each frame but the one corresponding to the target hash. Then, if we don’t allow the GIF to loop, it will end displaying the target MD5 hash, which is what we want.

To do so, we will, for each possible character of the MD5 hash, generate a MD5 collision at some place in the GIF. That’s 16×32=512 collisions to be generated, but we average 3.5 seconds per collision on our computer so it should run under 30 minutes.

Once this is done, we will have a valid GIF file. We can compute its hash: it will not change from that point.

Now that we have the hash, for each possible character of the MD5 hash, we will chose one or the other collision “block” previously computed. In one case, the character will be displayed, on the other it will be commented out. Because we replace some part of the GIF file with the specific collision “block” previously computed at that very same place, the MD5 hash of the GIF file will not change.

All what is left to do is to figure out how to insert the collision “blocks” in the GIF file (they look mostly random), so that:

  • It is a valid GIF file;
  • Using one “block” displays the corresponding character at the right position, but using the other “block” will not display it.

I will detail the process for one character.

Example for one character

Let’s look at the part of the generated GIF file responsible for displaying (or not) the character 7 at the first position of the MD5 hash.

The figure below shows the relevant hexdump displaying side by side the two possible choices for the collision block (click to display in full size):

hexdump of two version of a character

The collision “block” is displayed in bold (from 0x1b00 to 0x1b80), with the changing bytes written in red.

In the GIF file formats, comments are defined as followed:

  • They start with the two bytes 21fe (written in white over dark green background);
  • Then, an arbitrary number of sub-blocks are present;
  • The first byte (in black over a dark green background) describes the length of the sub-block data;
  • Then the sub-block data (in black over a light green background);
  • When a sub-block of size 0 is reached, it is the end of the comment.

The other colours in the image above represent other GIF blocks:

  • In purple, the graphics control extension, starting a frame and specifying the duration of the frame;
  • In light blue, the image descriptor, specifying the size and position of the frame;
  • In various shades of red, the image data (just as for comments, it can be composed of sub-blocks).

To create this part of the GIF, I considered the following:

  • The collision “block” should start at a multiple of 64 bytes from the beginning of the file, so I use comments to pad accordingly.
  • The fastcoll software generating a MD5 collision seems to always create two outputs where the bytes in position 123 are different. As a result, I end the comment sub-block just before that position, so that this byte gives the size of the next comment sub-block.
  • For one chosen collision “block” (on the left), the byte in position 123 starts a new comment sub-block that skips over the GIF frame of the character, up to the start of a new comment sub-block which is used as padding to align the next collision “block”.
  • For the other chosen collision “block” (on the right), the byte in position 123 creates a new comment sub-block which is shorter in that case. Following it, I end the comment, add the frame displaying the character of the MD5 hash at the right position, and finally start a new comment up to the comment sub-block used as padding for the next collision “block”.

All things considered, it is not that difficult, but many things must be considered at the same time so it is not easy to explain. I hope that the image above with the various colours helps to understand.

Final thoughts

Once all this has been done, we have a proper GIF displaying its own MD5 hash! It is composed of one frame for the background, plus 32 frames for each character of the MD5 hash.

To speed-up the displaying of the hash, we can add to the process a little bit of bruteforcing so that some characters of the hash will be the one we want.

I fixed 6 characters, which does not add much computations to create the GIF. Feel free to add more if needed.

Of course, the initial image (the background) should have those fixed characters in it. I chose the characters d5 and dead as shown in the image below, so that this speed-up is not obvious!

Background and hash compared

That makes a total of 28 frames. At 20ms per frame, displaying the hash takes a little over half a second.

Analysis of a GIF MD5 hashquine

Since I found out that an other GIF MD5 hashquine has been created before mine once I finished creating one, I thought it may be interesting to compare the two independent creations.

Here is spq’s hashquine:

spq's hashquine

The first noticeable thing is that 7-digits displays have been used. This is an interesting trade-off:

  • On the plus side, this means that only 7×32=224 MD5 collisions are needed (instead of 16×32=512), which should make the generation of the GIF more than twice as fast, and the image size smaller (84Ko versus 152Ko, but I also chose to feature my avatar and some text).
  • However, there is a total of 68 GIF frames instead of 28, so the GIF takes more time to load: 1.34 seconds versus 0.54 seconds.

Now, as you can see when loading the GIF file, a hash of 32 8 characters is first displayed, then each segment needed to be turned off is hidden. This is done by displaying a black square on top. Indeed, if we paint the background white, the final image looks like this:

Using a white background reveals black squares

My guess is that it was easier to do so, because there was no need to handle all 16 possible characters. Instead, only a black square was needed.

Also, the size (in bytes) of the black square (42 bytes) is smaller than my characters (58 to 84 bytes), meaning that it is more likely to fit. Indeed, I needed to consider the case in my code where I don’t have enough space and need to generate an other collision.

Other than that, the method is almost identical: the only difference I noticed is that spq used two sub-block comments or collision alignment and skipping over the collision bytes, whereas I used only one.

For reference, here is an example of a black square skipped over:

hexdump of a commented square

And here is another black square that is displayed in the GIF:

hexdump of a used square

Conclusion

Hashquines are fun! Many thanks to Ange Albertini for the challenge, you made me dive into the GIF file format, which I probably wouldn’t have done otherwise.

And of course, well done to spq for creating the first known GIF MD5 hashquine!

×

In Defense of Arrested Development Season 4

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

They Didn’t Make A Huge Mistake: In Defense of Arrested Development Season 4 (Freshly Popped Culture)

It was overstuffed, scattershot, and occasionally quite tedious — but also kinda brilliant? It’s Arrested Development Season 4.

It was overstuffed, scattershot, and occasionally quite tedious — but also kinda brilliant? It’s Arrested Development Season 4.

Earth-Moon Fire Pole

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

Earth-Moon Fire Pole (what-if.xkcd.com)

Earth-Moon Fire Pole My son (5y) asked me today: If there were a kind of a fireman’s pole from the Moon down to the Earth, how long would it take to slide all the way from the Moon to the Earth? Ramon Schönborn, Germany First, let’s get a few things out of the way: In…

How To Set Up an OSRM Server on Ubuntu 14.04

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

How To Set Up an OSRM Server on Ubuntu 14.04 | DigitalOcean (DigitalOcean)

The OpenStreetMap project consists of raw map data, collected and aggregated by thousands of users. This tutorial covers the configuration and maintenance of a web service using Open Source Routing Machine (OSRM), which is based on the OpenStreetMap d

The OpenStreetMap project consists of raw map data, collected and aggregated by thousands of users. However, its open access policy sparked a number of collateral projects, which collectively cover many of the features typically offered by commercial mapping services.

The most obvious advantage in using OpenStreetMap-based software over a commercial solution is economical convenience, because OpenStreetMap comes as free (both as in beer and as in speech) software. The downside is that it takes a little configuration in order to setup a working web service.

This tutorial covers the configuration and maintenance of a web service which can answer questions such as:

  • What is the closest street to a given pair of coordinates?
  • What’s the best way to get from point A to point B?
  • How long does it take to get from point A to point B with a car, or by foot?

The software that makes this possible is an open-source project called Open Source Routing Machine (OSRM), which is based on the OpenStreetMap data. Functionalities to embed OpenStreetMaps in Web pages are already provided out-of-the-box by APIs such as OpenLayers.

While slightly dated, I found this guide to be really valuable in my effort to set up a server that could spit out fastest walking routes around Oxford to support a PWA-driven tour of places relevant to J. R. R. Tolkien’s life, at my “day job”.

Maps Showing California as an Island – The Public Domain Review

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

http://publicdomainreview.org/collections/maps-showing-california-as-an-island/ (publicdomainreview.org)

If California were a country its economy would be the fifth largest in the world (just ahead of the UK). Yet the tech boom is not the starkest way California has ever stood apart from its neighbours. That would surely be the maps depicting it as an island, entire of itself. Below we have featured our pick of these glorious seventeenth- and eighteenth-century aberrations, from a collection of hundreds held at Stanford.

The intriguing story of how the maps came to be deserves a little mapping itself. In the 1530s Spanish explorers led by Hernán Cortés encountered the strip of land we now know as the Baja Peninsula. They mistook it for an island and called it California.

The woman who watched 300 executions in Texas

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

The woman who watched 300 executions (BBC News)

A former employee of the state of Texas describes the profound effect the executions had on her.

Texas has executed far more people than any other US state, and one former employee of the state has watched hundreds of executions unfold. She speaks to Ben Dirs about the profound effect that had on her.

It is 18 years since Michelle Lyons watched Ricky McGinn die. But it still makes her cry.

When she least expects it, she’ll see McGinn’s mother, in her Sunday best, her hands pressed against the glass of the death chamber. Dressed to the nines to watch her son get executed. Some farewell party.

For 12 years – first as a newspaper reporter, then as a spokesperson for the Texas Department of Criminal Justice (TDCJ) – it was part of Lyons’ job to witness every execution carried out by the state.

Between 2000 and 2012, Lyons saw almost 300 men and women die on the gurney, violent lives being brought to a peaceful conclusion, two needles trumping the damage done.

Lyons witnessed her first execution when she was 22. After seeing Javier Cruz die, she wrote in her journal: “I was completely fine with it. Am I supposed to be upset?”

The man with the golden blood

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

The man with the golden blood (The man with the golden blood)

Meet the donors, patients, doctors and scientists involved in the complex global network of rare – and very rare – blood. By Penny Bailey.

His doctor drove him over the border. It was quicker that way: if the man donated in Switzerland, his blood would be delayed while paperwork was filled out and authorisations sought.

The nurse in Annemasse, France, could tell from the label on the blood bag destined for Paris that this blood was pretty unusual. But when she read the details closely, her eyes widened. Surely it was impossible for this man seated beside her to be alive, let alone apparently healthy?

Thomas smiled to himself. Very few people in the world knew his blood type did – could – exist. And even fewer shared it. In 50 years, researchers have turned up only 40 or so other people on the planet with the same precious, life-saving blood in their veins.

I only have pretty regular (ABO-type O, Rh D+) blood, but it pleased me to discover this article right after I’ve started donating blood again after a long dry spell.

The Quakers are right. We don’t need God.

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

The Quakers are right. We don’t need God | Simon Jenkins by Simon Jenkins (the Guardian)

The group is considering dropping God from its meetings guidance. This is the new religiosity, says the Guardian columnist Simon Jenkins

The Quakers are clearly on to something. At their annual get-together this weekend they are reportedly thinking of dropping God from their “guidance to meetings”. The reason, said one of them, is because the term “makes some Quakers feel uncomfortable”. Atheists, according to a Birmingham University academic, comprise a rising 14% of professed Quakers, while a full 43% felt “unable to profess a belief in God”. They come to meetings for fellowship, rather than for higher guidance. The meeting will also consider transgenderism, same-sex marriage, climate change and social media. Religion is a tiring business.

I am not a Quaker or religious, but I have been to Quaker meetings, usually marriages or funerals, and found them deeply moving. The absence of ritual, the emphasis on silence and thought and the witness of “friends” seemed starkly modernist. Meeting houses can be beautiful spaces. The loveliest I know dates from 1700 and is lost in deep woods near Meifod, Powys. It is a place of the purest serenity, miles from any road and with only birdsong to blend with inner reflection.

The Quakers’ lack of ceremony and liturgical clutter gives them a point from which to view the no man’s land between faith and non-faith that is the “new religiosity”. A dwindling 40% of Britons claim to believe in some form of God, while a third say they are atheists. But that leaves over a quarter in a state of vaguely agnostic “spirituality”. Likewise, while well over half of Americans believe in the biblical God, nearly all believe in “a higher power or spiritual force”.

What these words mean is now the subject of intense debate…