Many Pies

Many Pies

Monday, October 28, 2013

Cryptography for curious kids



Here's part of a book I may never write.

Introduction

Why kids?

I read books on codes and ciphers when I was a kid and I loved them. Now I'm grown up I still like reading about codes and cryptography (and maths and science). I don't understand everything, but I reckon I can explain enough so that kids can have the same rough understanding of what's going on as me. There are still books on codes and ciphers for kids, but they don't go deep enough (note to self: check whether this is actually true before embarking on book). When I was a kid I wasn't aware that codes played that much part in life, apart from whatever spies got up to. These days however as soon as you go to a website and a padlock appears in your browser then you're using cryptography. This book still may not go deep enough for you, but hopefully it will take you deep enough to either satisfy your curiosity. You don't have to be a kid to read it, but the alliteration of the ks and cs sounds good.

Why curious?

You don't have to know how things work in order to use them, but if you're the sort of person who wonders what's really going on then this book is for you.


A shark through a drainpipe - one way hashes

Sharks have quite prominent gills. I can imagine, (though I haven't actually done it myself), that if you put a shark down a drainpipe that was just about wide enough to take it, it would be quite hard to drag it back up the other way. Not impossible, but so hard that you wouldn't really want to bother. A one way hash is like that.

Imagine you have a really long brioche roll with chocolate chips spread along it. They are spread so that every centimetre of roll either has one or no chocolate chips in it. You could chop this roll into 32cm pieces and then compare one pair of pieces side by side like this.


You then look at each centimetre of the rolls and follow the following rules:
If one of the rolls has a chocolate chip at that point then you transfer that chip to a new roll at the same point.
If neither of the rolls has a chocolate chip then the new roll doesn't get one either.
If both have a chip then the new roll doesn't get one.

This set of rules is called the XOR function (exclusive or - one or the other but not both). 

You then compare another 32cm length with the new roll until you've used up all the roll. (If the last bit is less than 32cm long then assume that it's actually 32cm long with no chips in the bits that aren't there.) At the end of it you'll have a brioche roll with a pattern of chocolate chips and gaps. As there's no randomness if you start with a certain pattern in your original roll then you'll always end up with the same pattern in the final roll. A set of rules used in this way is called a hash function. In practise hash functions are more complicated.

This is a one way hash. There could be two different original patterns that end up with the same final pattern. However to try and work backwards from the final roll to work out the original roll is hard - like dragging the shark backwards through the drainpipe. So it's not exactly one way, but near enough.

You could come up with different rules of chopping and combining and a good hash function will mean that if you start out with two original rolls that only have one chocolate chip difference the final roll will be really different.

So what's the use of a hash function? One thing you can do with it is to check that a file that you've downloaded is complete and hasn't got corrupted on the way. If the site you download the file tells you the hash of the file then you can use a program to work the hash of your file and if it matches then it is very probably the same as the original. Like the two rolls that are only different by one chocolate chip, a small corruption would give you a different hash, so it's really unlikely that the file would be corrupted in such as way that it's different to the original, but has the same hash.

Hashes and cryptography

One way that hashes are used in cryptography is when checking passwords. If a computer had a list of usernames and passwords in a file somewhere, and someone got that file, then they could log in as any one of those users. So the passwords are stored in hashed form. When someone types in their password it's hashed in the same way and then checked against the stored password. This is where the "really hard to find another thing that when hashed gives the same result" property is important. 




Thursday, October 24, 2013

Blue Pi Thinking from the University of York

I did Maths and Computer Science at the University of York (they don't like people calling it York University) and this year they gave new Comp Sci undergrads a Raspberry Pi before they started the course. I'm pondering what I would have done had that been me.

Wednesday, October 23, 2013

A time of "lasts"

High doors
So we're moving offices and Tim has written a good post Goodbye Wycliffe Centre. I've just been on what might be the last time I walk around the outside of our grounds. Yesterday we had the last of our weekly "Tuesday fellowship" meetings. (In future we'll meet monthly.) It's a time of lasts.

Update: in fact I took two more walks.

Tuesday, October 15, 2013

My heroine for Ada Lovelace Day - Kathy Sierra


My heroine for Ada Lovelace Day this year is the "programming instructor and game developer" Kathy Sierra. I've written about her return to blogging previously, but the thing that made me admire her even more was reading parts of one of the Head First books that she co-authored recently. It really focussed on making sure that the knowledge and wisdom got from the authors' heads into your own. I'd seen her thinking in the Creating Passionate Users blog, but here was the thoughts applied to a particular topic, Design Patterns in the case of that particular book and I was very impressed. You can find her on Twitter as @seriouspony.

(Picture by Ed Schipul. Licensed under a Creative Commons Attribution-Share Alike 2.0 Generic license.)

15 years with Wycliffe Bible Translators in the UK

My previous certificate of long service - for 10 years

15 years ago I went part-time in the job that I was doing. (I was surprised how there wasn't too much fuss when I asked to go part-time. Either it was because they wanted to see less of me, or because it was better than losing me altogether; I don't know which.) I then spent two days a week working for Wycliffe. One of them was in the office, which meant getting up at 6am to get onto the M25, and one was at home.

After 18 months of that, in April 2000 I went full-time as Business Systems Manager, one week before two major systems went live. That was a very busy time! In July 2004 I went from being a member to being an employee. Apart from a more steady income, it didn't make much difference at the time. In June 2010 I became IT Director whilst continuing to be Business Systems Manager.

Those are the major milestones - more detail will have to wait for my autobiography or my CV, neither of which I plan to write in the near future. The big thing on the mind at the moment is our office move, which will take place in two weeks' time.