Sunday, January 20, 2008

More Adventures in the Past, and in Geekdom

I was browsing some directories of my local filesystem, looking for amusement in lost and unfinished thoughts from the past, and I came across a directory called selma-hayek.

Selma Hayek is a human being. A female human being. A famous female human being. What she's famous for I don't know. I do remember that this directory on my filesystem has nothing to do with Selma Hayek; it contains the source code for a program called selma-hayek that I downloaded a long time ago.

There wasn't any immediate clue to the purpose of the program in any of the non-code files in the main directory, just a copy of the GPL and a blurb explaining to people why they shouldn't split long lines when they write code. It sort of made the assumption that everyone used xcode. I disagreed with it; I believe that long lines in source code almost always make programs hard to read, and that even if xcode, or even every editor, formatted extremely long lines in a readable way, that the art of programming extends down to the minutiae. That our canvas is the text file, a great medium whose possibilities grow quickly enough with size to be infinite for all practical purposes. Ideas somewhat similar to these are explored in Neal Stephenson's essay In the Beginning was the Command Line.

Anyway the point is that I wanted to know what this program was. There were Java and Ruby files in the directory. I know neither language in any real depth, and didn't really feel like trying to glean structure and purpose from code written by people that advocate using extremely long lines. So I thought that Google might know what it was.

Turns out that a Google search for "selma-hayek java ruby" returns results about Selma Hayek, coffee and jewels. There are a surprising number of pages that match this search, and most of them look pretty sketchy from the Googleblurbs. I feel bad for this Selma Hayek, whoever she is.

Wednesday, January 16, 2008

Enoch Root and Edward Abbey on the El

In Cryptonomicon Enoch Root devises an encryption scheme that he initially calls "Pontifex" and describes with the following perl script:

#!/usr/bin/perl -s
while length ($o)%5&&!$d;
$o=~s/X*$// if $d;$o=~s/.{5}/$& /g;
print"$o/n";sub v{$v=ord(substr($D,$_[0]))-32;
sub w{$D=~s/(.{$_[0]})(.*)(.)/$2$1$3/}
sub e{eval"$U$V$V";$D=~s/(.*)([UV].*[UV])(.*)/$3$2$1/;

(The program is somewhat obfuscated; to really understand it I had to type it out in a more readable form. Also, in reality the algorithm was designed by Bruce Schneier and the Perl script written by Ian Goldberg. Here is Bruce's description of the system)

It's later revealed that the same instructions, written in natural language instead of Perl, can be followed by a person with a deck of cards to generate a "keystream" of random-looking numbers. Two people that start with their decks in the same order can generate this same random sequence. The sender writes out his message, writes a number from the keystream under each letter, then circularly-shifts each letter forward in the alphabet by that number. The receiver receives a message that looks random to anyone else, circularly-shifts each letter backward by the same number the first person used, and the result is the original message. The whole system relies on a shared secret: the two people communicating know how to arrange the deck into its initial position, but nobody else does. In this sense it's similar to a one-time pad, where the communicators generate long sequences of random numbers while physically in contact and agree on which to use for which messages before they start communicating this way. The advantage is that in this case the shared secret, instead of pages full of numbers that can be physically confiscated by eavesdroppers, could be something memorizable, like (as Bruce Schneier suggests in an appendix to the novel) a simple system for generating a deck ordering based on Bridge scenarios published in some newspaper on the day the message was written. As with a one-time pad, there are two major ways that an eavesdropper could break it. First, by discovering the shared secret. Second, by discovering a bias, that is, by mathematically analyzing the keystream-generating algorithm and finding patterns in it. Finding a bias would cut down the number of likely keystreams, perhaps enough that they can all be checked by brute force. Such a bias has been found in Solitaire, as mentioned in Bruce Schneier's page, linked above.


Today after work I got on a Brown-Line train at the Merchandise Mart stop to ride all the way out to Francisco to go to my gym. Doors open on the right at Merchandise Mart, so I entered the crowded train from the right and had to stop and stand in the doorway, looking towards the left of the train. Seated to the right of the doors on the opposite side were a woman reading a book (not very interesting to watch) and a man repeatedly shuffling and fanning a deck of cards (somewhat more interesting). This guy must not have had much to do, or was practicing to escape the Chicago winters to become a card dealer in Vegas. Or maybe he was an Enoch Root, well-practiced at his card transformations, memorizing or analyzing the keystream generated from his deck transformations. It wasn't all that interesting, though, so I started reading.

Maybe at the Sedgwick stop the woman next to him got up, and I was the closest person to the seat she left, so I sat down. The man continued to shuffle his cards, sometimes accidentally jabbing me with an elbow, occasionally sneaking a glance at my book. I don't read secretly, so he may have caught a bit of Edward Abbey's description of his lazy trip down the Colorado River just before the building of the dam to form Lake Powell. At Belmont he stood up and flicked a card from his deck perfectly into the middle of the seat. The two of hearts. He walked out of the train. Transfer to Red- and Purple-Line trains at Belmont? Unlikely. Transferring at Belmont is for fools and amateurs. A man of his caliber would have obviously known to transfer at Fullerton.

So anyway a woman walked on the train, looked at the card on the seat. She recognized immediately that the first number of the keystream was 28! She probably looked at me funny, like I'd put the card there for some reason, but I don't really know because I had my face buried in Desert Solitaire trying to contain my laughter. Joy, mirth and laughter are not allowed on CTA vehicles. Do not make eye contact with other customers. If you see something, say something! Play safe; ski only in clockwise direction. Let's all have fun together. Especially with doomsday looming. She pocketed the card, sat down and started reading.

Tuesday, January 15, 2008

Cryptonomicon Breakdown

It's been a little while since I finished reading Cryptonomicon and about time I put down some thoughts on it here. It's a big and long book. I'll try to keep this short. And anyone interested can borrow this book from me at any time, unless someone else already is. I may mail it to you along with cookies if you ask nicely.

1. Science fiction novels of this sort might never be accepted by academic, "literary" folk. Not necessarily for reasons like those B. R. Myers suggests, and not just because such novels inspire political opinions far removed from those typical in academia. I really believe academics would look past that because Stephenson is an author with something to say and who is very influential with the drivers of the modern world (I'm not talking about "where the rubber hits the road", nor those navigating the route, I'm talking about the people mashing the gas and brakes, choosing the immediate direction through the tidy abstraction of the steering wheel). This particular novel drives them away by nakedly labeling academics as ninnies and frauds, yapping at the driver about the evils of internal combustion as he carries them to their destination. I hoped that an early confrontation between the hacker protagonist and some so-portrayed academics could serve more as a challenge to academia instead of a dismissal of it. Unfortunately Stephenson kept right on at the antagonism, using...

2. The story of Randy's love life. The whole thing makes no sense (Amy's knowledge of Randy's relationship history before chasing him to California is implausible, and that he's so impressed with her appearance at the airport, that he thinks her eagerness to do something for him is new after she's already chased him across the ocean to California is absurd) except as an allegory for the question of the hacker's role in society. The allegory here says that the hacker, when involved with academics, is out-of-place, unable to act out his true nature. When aligned with cutting-edge business he self-actualizes. That only in the pursuit of modern progress can the hacker truly be.

3. In the middle of the novel Stephenson portrays downtown Los Altos as the Feds break into the headquarters of a Valley tech company. I've been to Los Altos, and I've lived in Teh Valley. It ain't like that. Second Amendment-inspired libertarian techies don't parade around the streets with rifles, they mostly stay at home and post on Slashdot (or at most hang "Google Ron Paul" signs on highway overpasses at night). Government investigations of tech companies don't bring out crowds of dueling protesters and news reporters; Valley companies break the law so often and get caught at least often enough that neither event really registers. In fact, I don't think I ever saw that many people outside at once for any reason in Teh Valley, except on the freeways. The importance of physical and temporal concurrency is broken down by the increasing presence of the Internet in people's lives, and it's the techies (Teh Valley's defining population) that flock first from the streets to virtual worlds, leaving the emptiness and blandness of physical life (where the rubber hits the road) in Teh Valley.

4. The Enoch Root angle. Root apparently appears in other novels of the cycle during historical turning points, pushing basically in the direction of progress. Because of where he puts Root in this novel, set in the 90s, it's clear that Neal Stephenson believes that the universal availability of strong cryptography is vital for the narrative of perpetual progress to continue (maybe it's even safe to say he thinks it's a good thing). Cryptography allows people to keep secrets; crypto proponents, when explaining the importnance of this, often use the example of people trying to hide communications from repressive governments. But it's not just crypto that Enoch Root and all the "good" chracters of Cryptonomicon stand for. They're also establishing a new, fully-electronic, gold-backed, non-governmental currency. And the corporation they've formed to rule this new digital age is the very picture of the Valley tech company. It dodges taxes, hides information from its shareholders and the public at large, works towards its founders' sense of goodness. It is Google and Amazon (Amazon is in the real world the maker of markets, flattener of the long-tail), plus a physical infrastructure team, plus a small military wing. The new government of corporate feudalism, ruled by perfect competition. So Stephenson is making perhaps a highly anti-democratic statement.

Anti-democratic statements aren't necessarily wrong, of course. People frequently choose poorly for themselves. I frequently kick around the idea of rule by randomly-selected representatives, not so much because I think it's plausible, but because I think it highlights some of the flaws of our current republics and the ideas behind them, ideas that we so often take faithfully. The Epiphyte(2) Corporation, rulers of the post-end-of-Cryptonomicon world, enforce with the harshest intergalactic laws available (the laws of Really Tough Math) that collection of tax, other than bandwidth fees, is practically impossible, that people and governments can't spy en masse (though a few clever people can find information without breaking the codes), that their leaders and the leaders of their sibling tech companies will forever be able to hide from the prying eyes of democracy. They're dictators of their sector; happily, benevolent ones for now. As for later? There will be struggles and conflicts.

5. Conflict is a theme that runs through every Stephenson novel that I've read. That's a pretty vague theme, you might say. Well, how about this: they've all ended in the middle of violent struggle. The corporate wars and virtual swordfights of Snow Crash, global factional fighting in The Diamond Age, small-scale jungle combat in Cryptonomicon. Cryptonomicon's story of World War II, its central thesis made explicit in Enoch Root and Randy's conversations in jail, is the clearest statement that Stephenson basically believes in conflict. He believes that the right side (the progressive side) will eventually win if there is conflict. That without conflict societies lose their sense of what they believe in the first place and can't progress. Whether or not you believe that what I'm calling progress here is good, this is something that rings true to me: in a world of competitive civilizations, the progressive ones wipe out the others. We always worry that they (we) may wipe out themselves, too, just for the sake of completeness (ha, not really, actually just because we know no other way, or because there's still enough inequity and thus conflict to keep us fighting and thus progressing). This is a subject that I've got to do some reading on, because I'm sure Great Books have been written on the subject.

6. Enoch Root being an invincible magic man is, in my humble opinion, kind of lame. It might even undermine the theory of progress in conflict: if an invincible magic man is necessary to protect heroes and tilt conflicts, maybe conflict isn't inherently so directed as it's made out to be (one might also argue that in all of Stephenson's conflicts the good guys were going to win anyway, and some of the either implausible or supernatural stuff that happened was just there to give the Hiros (or Randys-and-Americas, as they may be) the happy endings they deserved). Root is, however, a Perl hacker, and has a cool email address, which redeems him.

Sorry, as usual, that this has run longer than I hoped, and that I thus don't have time to edit it tonight. And also that it basically makes no sense without reading the book. So you should read it! If you care about this kind of stuff.

Thursday, January 10, 2008

Reading on Trains

Since my hands can't handle winter biking without massive pain, I've been at the whim of the CTA for my daily work commute. This means I can read as I move, and I've been wishing that the El would run slowly again like it did in the fall so I wouldn't have to get off so soon. Earlier in the winter I read Neal Stephenson's Cryptonomicon. For a 950-page book it really flew by, because it's a page turner, and because I was already familiar with many of Stephenson's favorite themes, prejudices and archetypes. Also because it made me think abstractly and inwardly, and thus block out the calls of, Fullerton is next. Doors open on the left at Fullerton. Transfer to Red- and Purple-Line trains at Fullerton. This is a Brown-Line train to... Sunnyside and Crescent.

Well now I'm reading Edward Abbey's Desert Solitaire, which makes me want to look around myself, even though it's hard to think of a place more different than Abbey's lonely Utahan desert than Chicago. Lyndon gave me this book for Christmas. Among my brothers and me, only John can give gifts that aren't infused with his own ideology. But back to the point, this book makes me look out the windows. One light bulb after another in the subway. The neon 'B' in the word "Cubs" on Wrigley Field is out. So are the last two letters of "Storage" on two different sides of the same building near the Sheridan stop. I look out the right window until I see the Uptown Tattoo Factory, then out the left at Truman College, shuffle out of the train, bound down the stairs. To my left and across the street, Uptown Bikes. To my right, on this side, the Wilson-Broadway mall, a visually-but-not-aurally-loud cluster of convenience food and discount electronics purveyors.

I am not getting through this book very quickly.