Today’s xkcd isn’t so much a comic as it is an algorithm. An algorithm for something called “geohashing” (a pun on geocaching). It took me a couple minutes to figure it out, but once I did, I saw its geeky pointless brilliance. Basically, for any given day between 26 May 1896 and today, the algorithm will give you a unique nearby location (where nearby means within one degree of latitude and longitude). Okay fine. What’s cool is the how and why.
The algorithm starts with three pieces of information, a location (expressed in latitude and longitude), the date, and the most recent Dow Jones Industrial Average opening. The inclusion of the DJIA makes it impossible to pre-calculate future geohashes, except over weekends and holidays when the market is closed. The date and DJIA are concatenated and an md5 hash is generated from the resulting string. This is cool. Hash functions occur frequently in computer science. They’re a way to convert some arbitrary hunk of data into a single (potentially large) number. The simplest sort of hash is a checksum. Run a credit card number through the Luhn algorithm and if the resulting number ends in zero, it’s a valid credit card number. MD5 is what’s called a cryptographic hash function, which means a couple things. First, it must be difficult to find two messages that map to the same hash or to find a message that matches a given hash. And second, the resulting hash must not reveal anything about the original message. From the outside, the process must appear to generate arbitrary random numbers. Anyway, MD5 takes a message of any length and converts it to a 128-bit number. (As an aside, I should mention that although it is still widely used, a number of vulnerabilities in MD5 have been found).
The Geohashing algorithm (not to be confused with this) uses the first 64 bits of the hash as the decimal degrees of latitude and the second 64 as the decimal degrees of longitude. Combine these with the whole degrees of latitude and longitude of the original location and you get a new set of decimal coordinates. If this seems overly complicated, you can just use this tool to find the location for any day.
So what’s the use of this thing? Well, on its face, it’s all about the geeky pointlessness, but I could imagine some real uses, too. I wouldn’t be surprised to find groups of people planning meet-ups at geohashed location (followed by an overwrought exposé on Dateline when someone gets lost in the wilderness trying to make it to a meet-up). This could be a handy way to secretly pass things from person to person. Imagine replacing the DJIA with some other publicly-accessible bit of information and you could generate a new secret drop point everyday without having to communicate anything more than the date. Cool.
Oh, in case you were wondering, 26 May 1896 was the day the Dow Jones Industrial Average was first published.