This blog is no longer being updated. I've moved on to The Accidental Weblog. Hope to see you there.

Friday, November 26, 2004

In theory

Nice little bit from National Geographic's recent bit on evolution describing what a theory is in the context of science rather nicely:
Evolution by natural selection, the central concept of the life's work of Charles Darwin, is a theory. It's a theory about the origin of adaptation, complexity, and diversity among Earth's living creatures. If you are skeptical by nature, unfamiliar with the terminology of science, and unaware of the overwhelming evidence, you might even be tempted to say that it's "just" a theory. In the same sense, relativity as described by Albert Einstein is "just" a theory. The notion that Earth orbits around the sun rather than vice versa, offered by Copernicus in 1543, is a theory. Continental drift is a theory. The existence, structure, and dynamics of atoms? Atomic theory. Even electricity is a theoretical construct, involving electrons, which are tiny units of charged mass that no one has ever seen. Each of these theories is an explanation that has been confirmed to such a degree, by observation and experiment, that knowledgeable experts accept it as fact. That's what scientists mean when they talk about a theory: not a dreamy and unreliable speculation, but an explanatory statement that fits the evidence. They embrace such an explanation confidently but provisionally—taking it as their best available view of reality, at least until some severely conflicting data or some better explanation might come along.

-- from Was Darwin Wrong in National Geographic

There's more at that URL, thought it looks like you have to buy a hard copy actually to read the whole thing.

Tuesday, November 23, 2004

Oh God, Buffy... Was the entropy perfect for you too?

So in days of yore, back when IKE was ISAKMP-Oakley and IPSec was a sexy new idea (well, sexy as network protocols go), as some of you may know, I was working for a little Canadian startup called TimeStep which made some rather nifty little embedded crypto boxes.

I used to do white papers on cryptography (strictly speaking, actually, I guess I still do the odd white paper on crypto, provided the cheque is sufficiently convincing) from time to time, and one of the hardest things about doing a white paper on crypto is getting anyone who knows anything about crypto actually to read it for review. So the running gag I frequently presented the papers with was: 'there's a sex scene in it... somewhere... you just gotta look'. The theory being maybe this would get the reviewers to get through it a bit more quickly.

I don't really think anyone believed me. Though a few folk did actually complain when the promised sex scene did not appear. A few others, either very imaginative or very lonely, I must presume (or, I suppose, about as likely, they didn't read the paper and were bluffing), claimed to have found one.

But, in the end, it only seemed fair. I'd advertised, it was time to deliver product (this, I might note, in high tech, is actually the usual sequence in which things are done). Sooner or later, I had to write a real sex scene.

And thus Cryptolove was born: a crypto sex scene featuring two of the enduring characters from some of my papers (I'd dispensed with Alice and Bob early in my career--a near revolutionary move in the field, apparently--in favour of Biff and Buffy). It was essentially a run of cheap double entendres playing on crypto terms, roughly in the style of a typically overheated passage from a pulp romance novel. I even did a promotional poster for the thing (now, sadly, lost; it's been some years)--a cover from a product typical of the genre that inspired it, a shirtless guy and mostly shirtless gal wrapped in a passionate embrace--with a new title photoshopped in over the old one, in an appropriately tacky novelty font.

And today, gentle readers, is your lucky day. While it had begun to look for a while that the classic work was now a lost classic, a colleague from that very sordid period of my life surfaced the other day with a copy of the very text.

So here it is. Parents are of course cautioned. As are folk who wouldn't know a modular exponentiation if it bit you on the ass, as you're likely just to find the whole thing strange, (but yes, believe it or not, in the right company--that company being network crypto types and the poor suffering souls who love them--this thing has been known to elicit howls of laughter--or I think it's laughter; I'm never entirely sure). As are folk with anything resembling taste.

In any case, without further ado, the late, the great, Cryptolove:
Buffy finds herself driving, finally, along a quiet country lane, between trees crimson with autumn leaves, to a quiet satellite uplink station, in a quaint New England backwater, but still only two routers from the Internet backbone.
Her mind drifts, idle in the autumn wind, backwards through the history of their relationship. From the first time their IP stacks communicated from across a crowded network--those first few heady packets of the ISAKMP exchange--the flash of recognition when she realized that here, finally, was someone with a certificate she could authenticate, and who accepted hers as well for what it was--genuine, trusted, validated with MD5. The moment their nonces met and combined, in that first, tenuous connection that would grow so quickly to the full bloom of an IPSEC SA. The moment they first agreed on the terms of that same SA, and shared an SPI that was theirs and theirs only. The endless rolling, over and over, of keys through the tunnel, as they learned more and more of each other, in endless, tantalizing, teasing Diffie-Hellman exchanges.
At the station, enveloped in the soft chatter of the bank of dialup modems, he is waiting for her, and sees her crossing the yard with a yearning anticipation. She is everything he remembers--a wonderful, mysterious asymmetric algorithm he imagines put on earth for him and only him to decipher.
They meet, and their arms are around each other, their wrapper classes in a growing tangle sliding away from their bodies, their skin breathing grateful release in the still warm early autumn air, their fingers tracing delicate, teasing hashes along the surfaces of their half naked servers, the curve of his redundant arrays, the insides of her Ethernet ports. They collapse in a heap of tangled datagrams on the floor, laughing like 18 years olds dialing in for the first time. Their world is a wide open modular exponentiation, compressed to this moment and this moment only.
"Oh Biff, I want your key inside me," she breathes, the words mingled with a teasing cookie transmitted with a subtle yet undeniable hunger against his TCP port by the soft packet of her tongue.
He parts her input streams. She feels his hand stroking her warm, ready interfaces. And then he is inside her-- his bitstring a digital song against her. His key is huge, she realizes, 1024 bits or more...
He feels her moving powerfully, apparently randomly, yet clearly deterministically beneath him. He feels her ready strength, her endless complexity, the endless tumbling of checksums and feedback loops within her, rippling beneath the surface of her soft skin.
Values spiral out of them in moans as the message is decrypted. They move through one iteration. Then another. And another. And another. And another--each calculation coming more and more quickly on the heels of the last. They are moving in a rhythmic pulse of mathematical pleasure, and time winds away. The bandwidth is endless. It is heaven.
"Oh Biff," she moans, finally, as she feels the message cresting like a siren through herself. "I'm resolving!! I'm resolving!! Yes!! Yes!! Oh Yes!!!"
He feels a blue flash of pleasure, as suddenly, it all tumbles into place, and the plaintext is deciphered. He crashes, finally, against her, fully authenticated, his breath coming in short gasps...
"Oh god, Buffy," he breathes, finally, regaining his breath. "Was the entropy perfect for you too?"
Well. That's it. Don't say I didn't warn you.

Writing is rewriting

So I reworked substantial portions of the first two chapters of the book I'm still trying to sell--notwithstanding that the test readers seem to have been pretty positive, it still seemed to me a number of actually fairly central characters were giving off a suspicious odour of cardboard in their dialogue scenes, particularly earlier on. And there were two bits in those first two chapters that were really getting on my nerves.

I'm not sure if I'm (a) incredibly picky about dialogue, or (b) actually usually right that my first take at any dialogue scene will read like it was written for a bad daytime drama. I suspect it's principally the latter, with a bit of the former mixed in for good measure.

As to why those two bits in particular were so naggingly wrong (and were still so naggingly wrong, even after the rest of the book had got to the point I was pretty happy with it), I don't suppose it's so suprising. Coming into it cold after so many years effectively outta fiction, it rather makes sense the first few bits would be the roughest. And I didn't know the characters so well yet, was really just getting to know them.

As to why it took so long: I'd felt for a while that something had to be done there, but the bits were actually so far into the 'what the hell do I do with this' stage that I wasn't sure where to begin before now in cleaning it up.

In any case, I think I nailed it this time. I'm a lot happier with it now. They now talk like the people I now know them to be, and it comes off as a lot more interesting (or so I say). All I had to do was stop dicking around with the cosmetic fiddling and do some real surgery.