Crypto

Cryptography is a funny business; shady from the beginning, the whole business of codes and ciphers has been specifically designed to hide your intentions and move in the shadows, unnoticed. However, the art of cryptography has been changed almost beyond recognition in the last hundred years thanks to the invention of the computer, and what was once an art limited by the imagination of the nerd responsible has now turned into a question of sheer computing might. But, as always, the best way to start with this story is at the beginning…

There are two different methods of applying cryptography to a message; with a code or with a cipher. A code is a system involving replacing words with other words (‘Unleash a fox’ might mean ‘Send more ammunition’, for example), whilst a cipher involves changing individual letters and their ordering. Use of codes can generally only be limited to a few words that can be easily memorised, and/or requires endless cross-referencing with a book of known ‘translations’, as well as being relatively insecure when it comes to highly secretive information. Therefore, most modern encoding (yes, that word is still used; ‘enciphering’ sounds stupid) takes the form of employing ciphers, and has done for hundreds of years; they rely solely on the application of a simple rule, require far smaller reference manuals, and are more secure.

Early attempts at ciphers were charmingly simple; the ‘Caesar cipher’ is a classic example, famously invented and used by Julius Caesar, where each letter is replaced by the one three along from it in the alphabet (so A becomes D, B becomes E and so on). Augustus Caesar, who succeeded Julius, didn’t set much store by cryptography and used a similar system, although with only a one-place transposition (so A to B and such)- despite the fact that knowledge of the Caesar cipher was widespread, and his messages were hopelessly insecure. These ‘substitution ciphers’ suffered from a common problem; the relative frequency with which certain letters appear in the English language (E being the most common, followed by T) is well-known, so by analysing the frequency of occurring letters in a substitution-enciphered message one can work out fairly accurately what letter corresponds to which, and work out the rest from there. This problem can be partly overcome by careful phrasing of messages and using only short ones, but it’s nonetheless a problem.

Another classic method is to use a transposition cipher, which changes the order of letters- the trick lies in having a suitable ‘key’ with which to do the reordering. A classic example is to write the message in a rectangle of a size known to both encoder and recipient, writing in columns but ‘reading it off’ in rows. The recipient can then reverse the process to read the original message. This is a nice method, and it’s very hard to decipher a single message encoded this way, but if the ‘key’ (e.g. the size of the rectangle) is not changed regularly then one’s adversaries can figure it out after a while. The army of ancient Sparta used a kind of transposition cipher based on a tapered wooden rod called a skytale (pronounced skih-tah-ly), around which a strip of paper was wrapped and the message written down it, one on each turn of paper. The recipient then wrapped the paper around a skytale of identical girth and taper (the tapering prevented letters being evenly spaced, making it harder to decipher), and read the message off- again, a nice idea, but the need to make a new set of skytale’s for everyone every time the key needed changing rendered it impractical. Nonetheless, transposition ciphers are a nice idea, and the Union used them to great effect during the American Civil War.

In the last century, cryptography has developed into even more of an advanced science, and most modern ciphers are based on the concept of transposition ciphers- however, to avoid the problem of using letter frequencies to work out the key, modern ciphers use intricate and elaborate systems to change by how much the ‘value’ of the letter changes each time. The German Lorenz cipher machine used during the Second World War (and whose solving I have discussed in a previous post) involved putting the message through three wheels and electronic pickups to produce another letter; but the wheels moved on one click after each letter was typed, totally changing the internal mechanical arrangement. The only way the British cryptographers working against it could find to solve it was through brute force, designing a computer specifically to test every single possible starting position for the wheels against likely messages. This generally took them several hours to work out- but if they had had a computer as powerful as the one I am typing on, then provided it was set up in the correct manner it would have the raw power to ‘solve’ the day’s starting positions within a few minutes. Such is the power of modern computers, and against such opponents must modern cryptographers pit themselves.

One technique used nowadays presents a computer with a number that is simply too big for it to deal with; they are called ‘trapdoor ciphers’. The principle is relatively simple; it is far easier to find that 17 x 19 = 323 than it is to find the prime factors of 323, even with a computer, so if we upscale this business to start dealing with huge numbers a computer will whimper and hide in the corner just looking at them. If we take two prime numbers, each more than 100 digits long (this is, by the way, the source of the oft-quoted story that the CIA will pay $10,000 to anyone who finds a prime number of over 100 digits due to its intelligence value) and multiply them together, we get a vast number with only two prime factors which we shall, for now, call M. Then, we convert our message into number form (so A=01, B=02, I LIKE TRAINS=0912091105201801091419) and the resulting number is then raised to the power of a third (smaller, three digits will do) prime number. This will yield a number somewhat bigger than M, and successive lots of M are then subtracted from it until it reaches a number less than M (this is known as modulo arithmetic, and can be best visualised by example: so 19+16=35, but 19+16 (mod 24)=11, since 35-24=11). This number is then passed to the intended recipient, who can decode it relatively easily (well, so long as they have a correctly programmed computer) if they know the two prime factors of M (this business is actually known as the RSA problem, and for reasons I cannot hope to understand current mathematical thinking suggests that finding the prime factors of M is the easiest way of solving this; however, this has not yet been proven, and the matter is still open for debate). However, even if someone trying to decode the message knows M and has the most powerful computer on earth, it would take him thousands of years to find out what its prime factors are. To many, trapdoor ciphers have made cryptoanalysis (the art of breaking someone else’s codes), a dead art.

Man, there’s a ton of cool crypto stuff I haven’t even mentioned yet… screw it, this is going to be a two-parter. See you with it on Wednesday…

Advertisement

The Red Flower

Fire is, without a doubt, humanity’s oldest invention and its greatest friend; to many, the fundamental example what separates us from other animals. The abilities to keep warm through the coldest nights and harshest winters, to scare away predators by harnessing this strange force of nature, and to cook a joint of meat because screw it, it tastes better that way, are incredibly valuable ones, and they have seen us through many a tough moment. Over the centuries, fire in one form or another has been used for everything from being a weapon of war to furthering science, and very grateful we are for it too.

However, whilst the social history of fire is interesting, if I were to do a post on it then you dear readers would be faced with 1000 words of rather repetitive and somewhat boring myergh (technical term), so instead I thought I would take this opportunity to resort to my other old friend in these matters: science, as well as a few things learned from several years of very casual outdoorsmanship.

Fire is the natural product of any sufficiently exothermic reaction (ie one that gives out heat, rather than taking it in). These reactions can be of any type, but since fire can only form in air most of such reactions we are familiar with tend to be oxidation reactions; oxygen from the air bonding chemically with the substance in question (although there are exceptions;  a sample of potassium placed in water will float on the top and react with the water itself, become surrounded surrounded by a lilac flame sufficiently hot to melt it, and start fizzing violently and pushing itself around the container. A larger dose of potassium, or a more reactive alkali metal such as rubidium, will explode). The emission of heat causes a relatively gentle warming effect for the immediate area, but close to the site of the reaction itself a very large amount of heat is emitted in a small area. This excites the molecules of air close to the reaction and causes them to vibrate violently, emitting photons of electromagnetic radiation as they do so in the form of heat & light (among other things). These photons cause the air to glow brightly, creating the visible flame we can see; this large amount of thermal energy also ionises a lot of atoms and molecules in the area of the flame, meaning that a flame has a slight charge and is more conductive than the surrounding air. Because of this, flame probes are sometimes used to get rid of the excess charge in sensitive electromagnetic experiments, and flamethrowers can be made to fire lightning. Most often the glowing flame results in the characteristic reddy/orange colour of fire, but some reactions, such as the potassium one mentioned, cause them to emit radiation of other frequencies for a variety of reasons (chief among them the temperature of the flame and the spectral properties of the material in question), causing the flames to be of different colours, whilst a white-hot area of a fire is so hot that the molecules don’t care what frequency the photons they’re emitting are at so long as they can get rid of the things fast enough. Thus, light of all wavelengths gets emitted, and we see white light. The flickery nature of a flame is generally caused by the excited hot air moving about rapidly, until it gets far enough away from the source of heat to cool down and stop glowing; this process happens all the time with hundreds of packets of hot air, causing them to flicker back and forth.

However, we must remember that fires do not just give out heat, but must take some in too. This is to do with the way the chemical reaction to generate the heat in question works; the process requires the bonds between atoms to be broken, which uses up energy, before they can be reformed into a different pattern to release energy, and the energy needed to break the bonds and get the reaction going is known as the activation energy. Getting the molecules of the stuff you’re trying to react to the activation energy is the really hard part of lighting a fire, and different reactions (involving the burning of different stuff) have different activation energies, and thus different ‘ignition temperatures’ for the materials involved. Paper, for example, famously has an ignition temperature of 451 Fahrenheit (which means, incidentally, that you can cook with it if you’re sufficiently careful and not in a hurry to eat), whilst wood’s is only a little higher at around 300 degrees centigrade, both of which are less than that of a spark or flame. However, we must remember that neither fuel will ignite if it is wet, as water is not a fuel that can be burnt, meaning that it often takes a while to dry wood out sufficiently for it to catch, and that big, solid blocks of wood take quite a bit of energy to heat up.

From all of this information we can extrapolate the first rule that everybody learns about firelighting; that in order to catch a fire needs air, dry fuel and heat (the air provides the oxygen, the fuel the stuff it reacts with and the heat the activation energy). When one of these is lacking, one must make up for it by providing an excess of at least one of the other two, whilst remembering not to let the provision of the other ingredients suffer; it does no good, for example, to throw tons of fuel onto a new, small fire since it will snuff out its access to the air and put the fire out. Whilst fuel and air are usually relatively easy to come by when starting a fire, heat is always the tricky thing; matches are short lived, sparks even more so, and the fact that most of your fuel is likely to be damp makes the job even harder.

Provision of heat is also the main reason behind all of our classical methods of putting a fire out; covering it with cold water cuts it off from both heat and oxygen, and whilst blowing on a fire will provide it with more oxygen, it will also blow away the warm air close to the fire and replace it with cold, causing small flames like candles to be snuffed out (it is for this reason that a fire should be blown on very gently if you are trying to get it to catch and also why doing so will cause the flames, which are caused by hot air remember, to disappear but the embers to glow more brightly and burn with renewed vigour once you have stopped blowing).  Once a fire has sufficient heat, it is almost impossible to put out and blowing on it will only provide it with more oxygen and cause it to burn faster, as was ably demonstrated during the Great Fire of London. I myself have once, with a few friends, laid a fire that burned for 11 hours straight; many times it was reduced to a few humble embers, but it was so hot that all we had to do was throw another log on it and it would instantly begin to burn again. When the time came to put it out, it took half an hour for the embers to dim their glow.

So… why did I publish those posts?

So, here I (finally come)- the conclusion of my current theme of sport and fitness. Today I will, once again, return to the world of the gym, but the idea is actually almost as applicable to sport and fitness exercises generally.

Every year, towards the end of December, after the Christmas rush has subsided a little and the chocolates are running low, the western world embarks on the year’s final bizarre annual ritual- New Year’s Resolutions. These vary depending on geography (in Mexico, for example, they list not their new goals for the year ahead, but rather a list of things they hope will happen, generating a similar spirit of soon-to-be-crushed optimism), but there are a few cliched responses. Cut down on food x or y, get to know so and so better, finally sort out whatever you promise to deal with every year, perhaps even write a novel (for the more cocky and adventurous). However, perhaps the biggest cliched New Year’s Resolution is the vague “to exercise more”, or its (often accompanied) counterpart “to start going to the gym”.

Clearly, the world would be a very different place if we all stuck to our resolutions- there’d be a lot more mediocre books out there for starters. But perhaps the gym example is the most amusing, and obvious, example of our collective failure to stick to our own commitments. Every January, without fail, every gym in the land will be offering discounted taster sessions and membership deals, eager to entice their fresh crop of the budding gymgoer. All are quickly swamped with a fresh wave of enthusiasm and flab ready to burn, but by February many will lie practically empty, perhaps 90% of those new recruits having decided to bow out gracefully against the prospect of a lifetime’s slavery to the dumbbell.

So, back to my favourite question- why? What is it about the gym that can so quickly put people off- in essence, why don’t more people use the gym?

One important point to consider is practicality- to use the gym requires a quite significant commitment, and while 2-3 hours (ish) a week of actual exercise might not sound like much, given travelling time, getting changed, kit sorted and trying to fit it around a schedule such a commitment can quickly begin to take over one’s life. The gym atmosphere can also be very off-putting, as I know from personal experience. I am not a superlatively good rugby player, but I have my club membership and am entitled to use their gym for free. The reason I don’t is because trying to concentrate on my own (rather modest) personal aims and achievements can become both difficult and embarrassing when faced with first-teamers who use the gym religiously to bench press 150-odd kilos. All of them are resolutely nice guys, but it’s still an issue of personal embarrassment. It’s even worse if you have the dreaded ‘one-upmanship’ gym atmosphere, with everyone’s condescending smirks keeping the newbies firmly away. Then of course, there’s the long-term commitment to gym work. Some (admittedly naively) will first attend a gym expecting to see recognisable improvement immediately- but improvement takes a long time to notice, especially for the uninitiated and the young, who are likely to not have quite the same level of commitment and technique as the more experienced. The length of time it takes to see any improvement can be frustrating for many who feel like they’re wasting their time, and that can be as good an incentive as any to quit, disillusioned by the experienced.

However, by far the biggest (and ultimately overriding) cause is simply down to laziness- in fact most of the reasons or excuses given by someone dropping their gym routine (including perhaps that last one mentioned) can be traced back to a root cause of simply not wanting to put in the effort. It’s kinda easy to see why- gym work is (and should be) incredibly hard work, and busting a gut to lift a mediocre weight is perhaps not the most satisfying feeling for many, especially if they’re already feeling in a poor mood and/or they’re training alone (that’s a training tip- always train with a friend and encourage one another, but stick to rigid time constraints to ensure you don’t spend all the time nattering). But, this comes despite the fact that everyone (rationally) knows that going to the gym is good for you, and that if we weren’t lazy then we could probably achieve more and do more with ourselves. So, this in and of itself raises another question- why are humans lazy?

Actually, this question is a little bit of a misnomer, simply because of the ‘humans’ part- almost anyone who has a pet knows of their frequent struggles for the ‘most time spent lazing around in bed doing nothing all day’ award (to which I will nominate my own terrier). A similar competition is also often seen, to the disappointment of many a small child, in zoos across the land. It’s a trend seen throughout nature that, give an animal what he needs in a convenient space, he will quite happily enjoy such a bounty without any desire to get up & do more than necessary to get them- which is why zoo keepers often have problems with keeping their charges fit. This is, again, odd, since it seems like an evolutionary disadvantage to not want to do stuff.

However, despite being naturally lazy, this does not mean that people (and animals) don’t want to do stuff. In fact, laziness actually acts as a vital incentive in the progression of the human race. For an answer, ask yourself- why did we invent the wheel? Answer- because it was a lot easier than having to carry stuff around everywhere, and meant stuff took less work, allowing the inventor (and subsequently the human race) to become more and more lazy. The same pattern is replicated in just about every single thing the human race has ever invented (especially anything made by Apple)- laziness acts as a catalyst for innovation and discovery.

Basically, if more people went to the gym, then Thomas Edison wouldn’t have invented the lightbulb. Maybe.