Strengthening substitution ciphers

Fountain in Gatineau

The biggest problem with substitution ciphers (those that replace each letter with a particular other letter or symbol) is that they are vulnerable to frequency analysis. In any language, some letters are more common than others. By matching up the most common symbols with what you know the most common letters are, you can begin deciphering the message. Likewise, you can use rules like ‘a rare letter than almost always appears to the left of one specific more common letter is probably a Q.’ What is needed to strengthen such ciphers is a language in which words have no such ‘personality.’ Here is how to do it:

First, take all the short words (less than three letters) and assign them a random three digit code. Lengthening very short words further strengthens this approach because short words are the most vulnerable to frequency analysis; a single letter sitting with spaces on either side is probably ‘a’ or ‘i.’ Using three digit groups and 26 letters, you can assign 17,576 words. Now, take as many words from the whole language as you want to be able to use. For the sake of completeness, let’s use the entire Oxford English Dictionary. The 456,976 possible four letter groups more than suffice to cover every word in it, leaving some space for technical terms that we may want to encrypt but which might not be included. If we need even more possibilities, there are 11,881,376 five letter combinations.

This approach is cryptographically valuable for a number of reasons. Since the codes representing words have a random collection of letters, the letter frequency in a ‘translated’ message is also random. You no longer need to worry that some English letters are more common than others. Just as important, there are none of the ‘Q’ type rules by which to later attack the substitution cipher. The dictionary of equivalencies would not need to be secret; indeed, it should be widely available. Having the dictionary does not make encrypted messages more vulnerable, since they will have passed through a substitution cipher before being distributed and are fundamentally more robust to the cryptoanalysis of substitution ciphers than a message enciphered from standard English would be.

In the era of modern algorithms like AES, I doubt there is any need for the above system. Still, I wonder if there are any historical examples of this approach being used. If you have a computer to do the code-for-word and word-for-code substitutions, it would be quite a low effort mechanism to increase security.

Bad design and the Nokia 6275i

The way my Nokia 6275i stores text messages is very stupid. To begin with, it can hold 100 of them. Whether the internal memory (32 megabytes) is completely full or empty, that is the number. The message “hi” uses up a slot, just like any other message would. If you can use the internal memory for photos or videos or ringtones, why can’t you use it for text messages? 32 megabytes is enough for several novels worth of text.

Also ill considered is how it deals with the limit. You have three choices. You can set up the phone so that, once it is full, it explains this fact to you whenever someone sends you a message, which it does not store. Alternatively, you can tell it to automatically delete messages from your inbox, sent items, or both. If you set it to overwrite inbox, it slowly fills with sent messages, until you have 99 messages in the sent folder and can only keep one in your inbox at a time. If you set it to overwrite sent items, the converse occurs. If you set it to overwrite both, it lets the inbox fill while still deleting all sent messages. Keeping at least the last five of each would be far more sensible. Often, you send someone a message and – an hour later – get a response that only makes sense if you still have (or still remember) exactly what your original message said.

If you want to ensure that a particular message not be deleted, you can put it in your ‘archive.’ It still uses up one of your 100 slots, but at least it will not be deleted by the over-writing algorithm.

Finally, if anyone sends a message of more than 160 characters, it just deletes all the text beyond that. Every Nokia phone I had previously would split overly long messages into multiple versions. With this phone, written conversations with some people take on the feeling of reading a heavily censored CIA document.

To Nokia’s software engineers: please try to be less obtuse in how you design the critical functions of your phones. Those of us who send more than thirty text messages a day consider it a key feature. A few sensible changes will leave your customers a lot less annoyed.

Decline and fall of an iBook

Alexandra Bridge, Ottawa

After more than two years of faithful service, my laptop is now having serious problems. It takes upwards of ten minutes to boot, frequently forgets important preferences (like to ask for a password before letting you log in), and has distinct trouble connecting to wireless networks. In general, performance has become spotty and unreliable. Things have reached the point where I would ordinarily suspect that a virus has been generating minor havoc, though scans have not supported that hypothesis.

I am tempted to make a full backup, format my hard drive, and start from a clean install. That said, I think the inevitable physical breakdown of hardware is reasonably likely to be the cause of my woe. The constant ambient heat here – enough to keep the fan running constantly, which almost never started in Oxford – will certainly contribute to breakdown. The machine is still subject to the AppleCare plan I purchased, so perhaps it is worthwhile to send it on a potentially refreshing trip to the Apple store before such a lobotomy is carried out.

Once the IKEA bills have been paid off and some sort of a bike has been acquired, it may be time to start thinking about a new Mac.

Reading about ten hours a day

Museum of Civilizations

In addition to all the reading I have been doing for my first big project at work, I am finding myself well-immersed in interesting personal reading. Aside from the stack of fiction that has been oscillating in size for about a year, I am reading George Monbiot’s Heat: How to Stop the Planet from Burning and Harold Coward and Andrew J. Weaver’s book Hard Choices: Climate Change in Canada. Simon Singh’s The Code Book is catering to a less immediately work-related interest, as is the Simon Blackburn book Antonia gave me.

It can be tough to maintain an appetite for the written word that exceeds the immediate requirements of work and the secondary need to keep up to date on current events. Of course, it is essential in order to become and remain an informed member of society.

Unrelated: Emily introduced me to a new web comic: The Perry Bible Fellowship. It is pretty random, but also quite funny at times.

Arisen

IKEA Ottawa

Having corrected some errant DSL settings, I am now online. I can now properly say that I have a place to live, rather than simply an area in which I am storing my stuff.

Now that I am off the EC network and can freely access sites of a social nature, I can announce the following: Emily Horn, dashing young woman who I met at Cabin Fever 3, has a new blog emerging: thebeanery.wordpess.com. I look forward to seeing what evolves there.

Still in the wilderness

Human shapes and fire engines

Unfortunately, I am still sans internet. It seems the only way to get DSL is to pledge an entire working day, then wait to discover what time the installation team cares to show up. They don’t do evenings or weekends, naturally, and they certainly cannot commit to a time more specific than ‘probably am’ or ‘probably pm.’

To anyone who has sent messages to my personal email accounts, I apologize. I simply cannot check them until I get access at home or lug my laptop to a coffee shop downtown. The latter, I may undertake tonight.

[Update: 31 July 12:05pm] At least my July 21st issue of The Economist has finally managed to wander to the right place. I am not entirely isolated from the goings on in the world outside the TLC complex.

[Update: 1 August 2007] By midnight on August 3rd, I will have a DSL connection through TekSavvy – one of the local ISPs that seems to be well liked by people on web forums. Thankfully, someone who lived in my flat previously had DSL set up; as such, I don’t need to spend an entire day waiting for Bell to show up and make hardware adjustments.

To sleep, perchance to dream

Marc Gurstein and IKEA furniture

I have discovered an additional element of full time work. It concerns what might be called a Wakefulness Index (WI): a notional figure representing one’s ability to concentrate and think creatively at any point in time. The index has natural oscillations; for me, it probably peaks in the afternoon and evening (insofar as work related thinking is concerned). Of greater personal policy importance is what might be called wakefulness forcing, the undertaking of behaviours and actions that alter one’s wakefulness index during subsequent hours or days.

Such behaviours encompass everything from the micro (a particular decision regarding caffeine consumption) to the macro (the selection of an overall sleep regime). All this seems clear to me right now because of one of the major choices that frequently needs to be made, in regard to wakefulness. That is, the decision of whether to use leisure time (especially weekends) for the purpose of increasing your index (resting, but not doing much else) or decreasing it, but having a lot more fun.

It is a classic biological trade-off like, for instance, the balance between time spent looking for food and time spent looking for a mate. Like all such balances, there are multiple stable equilibria and a near infinite number of ways to shift between them. In the interest of overall balance, since yesterday and this morning were used as WI investments, I will have to draw down the account a bit tonight.

Ottawa River hydro

Bridge to Gatineau

Right near the complex where I work, there is an unusual hydroelectric system on the Ottawa river. On either side of the main channel are large concrete canals with blocks of turbines. From those, high voltage power lines extend. In the middle of the river, there is a long arc of gates. These are to manage the degree to which water flows through the side channels, and the degree to which it flows over the uneven stone surfaces that were once natural cascades.

Since the water level in the river is high, there is pretty much always some degree of overflow venting through the gates. The little building you can see above them actually moves along the arc, raising and lowering gates. I am not sure if there are people inside or whether it is robotic, but everyone with an office on the south side of my building has a constant view of the whole installation. Those on the north side must content themselves with the fountain at a Gatineau casino.