## Tuesday, June 28, 2011

### Density of expanded polystyrene and expanded polyurethane foam

I recently posted about an experiment with expanded polyurethane foam and I was asked in a forum about the relative density of it and the expanded polystyrene I had previously used.

1. GAGA-1 Expanded Polystyrene Container

Weight: 213g
Outside dimensions: 245mm cube
Inside dimensions: 150mm cube

Thus, volume is 0.01471 m^3 - 0.003375 m^3 = 0.011335 m^3

Which gives a density of 18,791.4 g/m^3

2. My experimental capsule using expanding polyurethane foam

Weight: 25g
Diameter: 90mm
Height: 200mm
Internal space: 100 mm x 65 mm x 35 mm

Thus, volume is 0.001272 m^3 - 2.275×10^-4 m^3 = 0.001045 m^3

Which gives a density of 23,923 g/m^3.

Thus the expanding polyurethane foam is about 25% heavier than expanded polystyrene for the same volume.

Various sources give the R-value give an approximate 2x increase in R-value of polyurethane over polystyrene. Thus for the same thickness it would be expected that the polyurethane is a better insulator at a slightly greater weight. And the insulation increase outweighs the extra weight (200% vs. 25%).

## Monday, June 27, 2011

### Experiments with polyurethane foam for injection molding a HAB capsule

Back when I worked on GAGA-1 I used a polystyrene container for the capsule. This worked well but it was quite large and polystyrene is annoying to cut.

So, I've been experimenting with expanding polyurethane foam to injection mold a HAB capsule.

My first experiment was to work with a big block of foam that I sprayed onto a sheet of baking parchment. The foam doesn't stick to the parchment and it can be easily peeled off. The set foam can be easily cut with both a saw (a bit messy since small parts break off) or with a Stanley knife. The Stanley knife gave clean cuts. It was also possible to hollow out a space inside the foam where the electronics could be stored.

One test I did was to see how strong the cured foam is by hitting it with a hammer. Here you can see the hollowed out capsule as I hit it with a geological hammer. It seemed strong enough to me for a HAB landing.

I then tested various glues and paints on the surface. Here I've painted it with spray paint (yellow) that is solvent based, again with the acrylic paint I used for the GAGA-1 capsule, then drawn on it with permanent markers, stuck on some yellow duct tape, glued on with spray adhesive some space blanket and used epoxy to stick some more space blanket in place.

The solvent based paint did not attack the foam, but the coverage wasn't good and once again the acrylic paint put on with a brush gave the best yellow colour (at the top of the photograph). The epoxy glue stuck well and didn't damage the space blanket or foam (the spray glue didn't adhere well). The markers didn't damage the foam but the outside of the foam can't take much pressure from the marker tip.

The duct tape stuck well, but I wouldn't use it as the only means of keeping the capsule sealed. Next I left the capsule in the freezer (at -18C) overnight to see if the foam became brittle.

Didn't notice any ill effect from this temperature, but still need to do a proper test of the insulating properties.

Next I moved onto the injection molding experiment. I made a mold from a thin sheet of cardboard that came from a dry cleaner (used to hold folded shirts) coated with baking parchment. This was rolled up and taped and a piece of parchment used to seal one end.

Then I made a small mold for the space where the electronics will go from an old business card holder covered in baking parchment and some tape.

Then I suspended it inside the tube. This was a mistake because it really need to be suspended better because as the foam expanded later the box moved and I had to manually push it back into the appropriate position before the foam set (wear gloves!).

Then I sprayed the inside with water to help the reaction and sprayed in the foam from a can. After letting it set over night the mold looked like this:

I cut off the bottom with the Stanley knife with ease to reveal a nice strong pattern of foam inside.

And the parchment was pretty easy to remove to reveal the capsule.

Here's the trimmed capsule when removed from the mold.

And a slice through revealed the mold inside.

With a bit of pulling the bottom half was off revealing the internal mold. I had to cut through the cord to remove it and then pull the cord out completely.

And finally the completed capsule in two parts.

And shown next to the GAGA-1 capsule to show its size for comparison.

The GAGA-1 capsule weighed over 200g, this one weighs 25g. Switching from Arduino to Arduino Pro saves another 18g.

So, I think I could put together a HAB project whose goal would be to go for maximum altitude with a total capsule weight in the 100s of grams (including a very lightweight video camera this time).

Will have to see if I have time to work on GAGA-2: Baby Gaga.

## Saturday, June 25, 2011

### Making a 'Ponyo' or putt-putt boat

If you've seen the film Ponyo (or if you grew up in Asia) you may have seen a sort of toy boat powered by a very simple steam engine. This sort of boat is variously called a putt-putt or pop-pop.

They work by having a very simple boiler powered by a candle in which water is turned to steam. The steam forces water out of a pair of tubes creating a partial vacuum which sucks water back in. The distinctive pop sound comes from the movement of the thin metal boiler's walls.

I came across lovely plans for building such a boat from a drink can and a milk carton from Science Toy Maker. The explanation and videos are really clear and easy to follow and the boat worked first time. Here's a short video showing it under test in my sink:

The first step in the instructions is making the engine. It uses a drink can, two straws and some epoxy glue. If you follow the video instructions it's not hard to make. Here's the can with the lid cut off using scissors:

Then it's folded in half and held together with some tape:

Then a pattern of cuts and folds is stuck on with more tape and the can is cut in two places and two folds are made to form the boiler:

Once folded the boiler is completely flat:

Then by gentle squeezing and inserting some straws you form the boiler shape which is fixed using epoxy glue:

Finally the straws are glued into place with epoxy and bent until he correct angle. The bends are hot-glued to keep them from unbending:

Then the engine is ready for a power test.

The boat itself uses a milk or juice carton. Here's one I borrowed from someone's party:

There's a simple pattern to print out and stick to the flatten out carton:

A bit of cutting, folding and stapling and the boat takes shape:

Then you stretch the boat to change the shape of the bow:

Finally, I painted it using a spray silver paint that was polystyrene safe and inserted the engine. The engine is hot-glued in place which helps seal up around the straws and weigh the boat down.

## Friday, June 24, 2011

### Mean and standard deviation of the distances between letters

The following table shows is computed by calculating the distance between occurrences of letters in Jane Austen's Pride and Prejudice (for example, the distance between e's in the sentence "Hello, my name is Jeremy" is 9 and 2; all punctuation and spaces are ignored).

LetterMeanStandard Deviation
e7.76.3
t11.510.0
a12.911.1
o13.312.0
i14.212.3
n14.212.5
h16.014.2
s16.315.6
r16.514.4
d24.122.2
l25.025.9
u35.634.5
m36.535.1
c39.239.2
y42.342.3
w43.941.9
f44.643.9
g52.850.4
b58.955.6
p63.568.3
v94.492.0
k165.1172.8
j569.2638.9
z582.8834.4
x635.0669.6
q859.4873.9

## Thursday, June 23, 2011

### Importing an existing SSL key/certificate pair into a Java keystore

I'm writing this blog post in case anyone else has to Google that. In Java 6 keytool has been improved so that it now becomes possible to import an existing key and certificate (say one you generated outside of the Java world) into a keystore.

You need: Java 6 and openssl.

1. Suppose you have a certificate and key in PEM format. The key is named host.key and the certificate host.crt.

2. The first step is to convert them into a single PKCS12 file using the command: openssl pkcs12 -export -in host.crt -inkey host.key > host.p12. You will be asked for various passwords (the password to access the key (if set) and then the password for the PKCS12 file being created).

3. Then import the PKCS12 file into a keystore using the command: keytool -importkeystore -srckeystore host.p12 -destkeystore host.jks -srcstoretype pkcs12. You now have a keystore named host.jks containing the certificate/key you need.

For the sake of completeness here's the output of a full session I performed:
```\$ openssl pkcs12 -export -in host.crt -inkey host.key > host.p12
Enter pass phrase for host.key:
\$ keytool -importkeystore -srckeystore host.p12 -destkeystore host.jks
-srcstoretype pkcs12
Entry for alias 1 successfully imported.
Import command completed:  1 entries successfully imported, 0 entries failed
or cancelled
```

## Wednesday, June 15, 2011

### Identification of homophone sequences in the Zodiac 408 cipher

In my previous post I mentioned an algorithm that I thought would identify homophone sequences used in the Zodiac 408 cipher. I wrote a small test program. Here's the output (note that here I have not used Unicode characters but the encoding scheme from this site).

The output shows the cipher being split on successive symbols and then shows the subsequences found (and within which of the splits it was found). It's clear that lots of subsequences are found (validating that the Zodiac 408 uses simple sequential homophone sequences) and it finds the longer sequences used.

This technique looks pretty viable for this type of cipher. However, tests on the Zodiac 340 show that it isn't working there. Either The Zodiac switched from a sequential pattern for the homophones, or there's some scrambling (in the form of transposition).

I've marked in bold a few very likely sequences (long ones, or those that occur frequently). These are all actual sequences used by The Zodiac.

```!: 5 (7 A f r \ z c)
#: 10 (A f L d r \ z)
%: 11 (P Z U B)
3: (% P B) found in 2 3 4 8
(: 4 (# A f l E L d r \ z)
): 8 (S ( # A f l E L d r \ 8)
3: () E L) found in 2 3 5 7
+: 8 (G 6 K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \ 8)
3: (+ 6 E) found in 2 3 4 5
3: (+ E 8) found in 2 4 5 7
3: (+ N E) found in 2 3 4 5
3: (+ T 8) found in 2 4 5 7
3: (+ T #) found in 2 4 5 7
3: (+ T 5) found in 2 4 6 7
3: (+ G 8) found in 2 4 5 7
3: (+ G I) found in 2 4 5 7
3: (+ G #) found in 2 4 5 7
3: (+ 6 8) found in 2 4 5 7
3: (+ 6 N) found in 2 3 4 5
3: (+ 6 I) found in 2 3 4 5 7
3: (+ 6 5) found in 2 3 4 7
3: (+ D 8) found in 2 4 5 7
3: (+ t 8) found in 2 4 5 7
3: (+ D #) found in 2 4 5 7
3: (+ t D) found in 2 4 5 7
3: (+ t #) found in 2 4 5 7
4: (+ 6 N E) found in 2 3 4 5
/: 6 (Z)
5: 8 (S ( # A f l E L d r \)
3: (5 L \) found in 3 4 6 7
3: (5 L r) found in 3 4 5 6
6: 8 (! 7 T t N Q 5 S ( # A f l E L d r \ 8)
3: (6 t L) found in 2 3 4 5
3: (6 N E) found in 2 3 4 5
3: (6 N L) found in 2 3 4 5
3: (6 N 5) found in 2 3 4 5
3: (6 E L) found in 2 3 4 5
3: (6 5 L) found in 2 3 4 5
4: (6 N 5 L) found in 2 3 4 5
4: (6 N E L) found in 2 3 4 5
7: 3 (j _)
8: 8 ()
9: 14 (P Z U k O R p X W V + e G Y F 6)
3: (9 R Y) found in 3 4 6 11
3: (9 P W) found in 3 4 5 9 13
3: (9 W +) found in 3 5 8 9
3: (9 Z W) found in 3 4 5 9 13
3: (9 U W) found in 3 4 5 11
3: (9 O W) found in 3 4 5 11 13
3: (9 R W) found in 3 4 5 11 13
3: (9 p W) found in 3 4 5 9
3: (9 P +) found in 3 5 9 13
3: (9 P Z) found in 3 4 5 13
3: (9 P U) found in 2 3 4 5 6 7 8
3: (9 P k) found in 2 3 4 5 6 7 8
3: (9 P R) found in 3 4 5 6 13
3: (9 P p) found in 3 4 5 7 9
3: (9 P e) found in 2 3 5 8 9
3: (9 P G) found in 3 6 8 13
3: (9 P F) found in 3 5 9 13
3: (9 P V) found in 3 5 6 9 13
3: (9 Z +) found in 3 5 9 13
3: (9 O +) found in 3 5 11 13
3: (9 R +) found in 3 5 11 13
3: (9 V +) found in 3 5 8 9
3: (9 Z p) found in 3 4 5 7 9
3: (9 Z V) found in 3 5 9 13
3: (9 U k) found in 2 3 4 5 6 7 8
3: (9 U p) found in 3 4 5 7
3: (9 U G) found in 3 6 8 11
3: (9 U V) found in 3 5 6 11
3: (9 O R) found in 3 4 5 11 13
3: (9 O G) found in 3 4 8 11 13
3: (9 O V) found in 3 5 11 13
3: (9 R e) found in 3 5 6 11
3: (9 R G) found in 3 4 6 11 13
3: (9 R V) found in 3 5 6 11 13
3: (9 e G) found in 3 6 8 11 13
3: (9 V e) found in 3 8 9 11
3: (9 V G) found in 3 6 8 11
4: (9 P U k) found in 2 3 4 5 6 7 8
4: (9 P U p) found in 3 4 5 7
4: (9 P p W) found in 3 4 5 9
4: (9 P R V) found in 3 5 6 13
4: (9 P Z W) found in 3 4 5 13
4: (9 P R W) found in 3 4 5 13
4: (9 O R W) found in 3 4 11 13
4: (9 Z p W) found in 3 4 5 9
=: 7 (p X)
@: 6 (K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \ 8)
3: (@ 5 L) found in 2 3 4 5
3: (@ 5 #) found in 2 3 4 5
3: (@ K 5) found in 2 3 4 5
3: (@ 5 E) found in 2 3 4 5
3: (@ K L) found in 2 3 4 5
3: (@ E L) found in 2 3 4 5
3: (@ t L) found in 2 3 4 5
3: (@ K #) found in 2 3 4 5
3: (@ K T) found in 2 3 4 5
3: (@ K E) found in 2 3 4 5
3: (@ K t) found in 2 3 4 5
4: (@ 5 E L) found in 2 3 4 5
A: 8 (f z j _)
B: 12 (k O R p X)
3: (B O R) found in 3 7 10 11
D: 6 (5 ) S ( # A f l E L d r \ 8)
3: (D 5 L) found in 2 3 4 5
3: (D E L) found in 2 3 4 5
E: 9 (L d r \ z)
3: (E L r) found in 3 4 5 7
3: (E L \) found in 3 4 5 7
F: 6 (6 H @ K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \)
G: 7 (6 K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \ 8)
3: (G I N) found in 2 3 4 5
3: (G I 5) found in 2 3 4 5
3: (G I 8) found in 2 3 4 5
3: (G I )) found in 2 3 4 5
H: 8 (@ K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \)
3: (H ) E) found in 2 3 5 6
3: (H N E) found in 2 3 5 6
3: (H D E) found in 2 3 5 6 7
3: (H I E) found in 2 3 5 6 7
3: (H 5 E) found in 2 3 5 6 7
3: (H T E) found in 2 5 6 7
3: (H t E) found in 2 5 6 7
3: (H @ E) found in 2 5 6 7
3: (H # E) found in 2 3 6 7
3: (H D L) found in 2 5 6 7
3: (H I L) found in 2 3 4 5 6
3: (H 5 L) found in 2 3 4 5 6
3: (H t L) found in 2 4 5 6
3: (H I r) found in 3 5 6 7
3: (H I )) found in 2 3 4 5 6
3: (H D d) found in 2 5 6 7
3: (H I N) found in 2 3 5 6
3: (H D 5) found in 2 5 6 7
3: (H I 5) found in 2 3 4 5 6
3: (H I t) found in 2 4 5 6
3: (H @ t) found in 2 5 6 7
4: (H I 5 L) found in 2 3 4 5 6
4: (H I 5 E) found in 2 3 5 6
4: (H D 5 E) found in 2 5 6 7
4: (H I t L) found in 2 4 5 6
4: (H I N E) found in 2 3 5 6
4: (H I ) E) found in 2 3 5 6
I: 11 (7 T t N Q 5 ) S ( # A f l E L d r \ 8)
3: (I 5 L) found in 4 5 6 7 8
J: 6 (I 7 T t N Q D 5 ) S ( # A f l E L)
K: 5 (! I 7 T t N Q 5 ) S ( # A f l E L d r \ 8)
L: 8 (d r \ z)
M: 8 (J I 7 T t N Q D 5 ) S ( # A f l E L)
3: (M N E) found in 2 4 5 7
3: (M E L) found in 2 4 5 7
3: (M I 5) found in 2 3 4 5
3: (M I L) found in 2 3 4 5
3: (M ) L) found in 2 3 5 7
3: (M t L) found in 2 4 5 7
3: (M 5 L) found in 2 3 4 5 7
3: (M N L) found in 2 4 5 7
4: (M N E L) found in 2 4 5 7
4: (M I 5 L) found in 2 3 4 5
N: 6 (Q # A f l E L d r \ z)
O: 7 (R p X W V + G F 6 H @ K ! M J ^ I 7 T t N Q D 5 ) S ( #)
3: (O G #) found in 3 4 5 6
3: (O ^ #) found in 3 4 5 6
3: (O X #) found in 3 4 5 6
3: (O W #) found in 3 4 5 6
3: (O K 5) found in 2 3 4 6
3: (O R 5) found in 2 3 4 6
3: (O G 5) found in 2 3 4 6
3: (O ^ 5) found in 2 3 4 6
3: (O X 5) found in 2 3 4 6
3: (O W 5) found in 2 3 4 6
3: (O H 5) found in 2 3 4 6
3: (O R +) found in 2 3 4 6
3: (O p +) found in 2 3 4 5
3: (O W +) found in 2 3 4 5
3: (O + 6) found in 2 3 4 6
3: (O R K) found in 2 3 4 6
3: (O M N) found in 2 3 4 5
3: (O G N) found in 2 3 4 5
3: (O ^ N) found in 2 3 4 5
3: (O I N) found in 2 3 4 5
3: (O 6 N) found in 2 3 4 5
3: (O M )) found in 2 3 4 5
3: (O R D) found in 2 3 4 6
3: (O R W) found in 2 3 4 6
3: (O R 6) found in 2 3 4 6
3: (O R H) found in 2 3 4 6
3: (O G )) found in 2 3 4 5
3: (O G I) found in 2 3 4 5
3: (O p W) found in 2 3 4 5
3: (O ^ )) found in 2 3 4 5
3: (O I )) found in 2 3 4 5
3: (O ^ D) found in 2 3 4 5 6
3: (O W D) found in 2 3 4 6
3: (O H D) found in 2 3 4 6
3: (O ^ I) found in 2 3 4 5
3: (O W 6) found in 2 3 4 6
4: (O R K 5) found in 2 3 4 6
4: (O G I )) found in 2 3 4 5
4: (O G I N) found in 2 3 4 5
4: (O ^ I )) found in 2 3 4 5
4: (O ^ I N) found in 2 3 4 5
4: (O p W +) found in 2 3 4 5
P: 11 (Z U k O R p X W V + e G Y F 6 H)
3: (P O R) found in 3 5 9 10
3: (P O +) found in 3 5 9 10
3: (P O X) found in 3 5 9 10
3: (P R F) found in 3 5 9 10
3: (P R V) found in 3 5 6 9
3: (P R +) found in 3 5 9 10
3: (P R H) found in 3 5 6 9
3: (P R G) found in 3 6 9 10
3: (P R W) found in 3 4 5 9
3: (P R X) found in 3 5 9 10
3: (P V +) found in 3 5 7 9
3: (P U V) found in 3 5 6 7 9
3: (P p V) found in 3 5 7 9
3: (P W +) found in 3 5 7 9
3: (P U +) found in 3 5 7 9
3: (P p +) found in 3 5 7 9
3: (P U 6) found in 3 5 8 9
3: (P e 6) found in 3 5 8 9
3: (P U H) found in 3 5 6 9
3: (P U G) found in 3 6 8 9
3: (P k W) found in 3 4 5 7
3: (P U W) found in 3 4 5 7 9
3: (P p W) found in 3 4 5 7 9
3: (P U k) found in 2 3 4 5 6 7 8
3: (P U Y) found in 2 3 5 9
3: (P e Y) found in 2 3 5 9
3: (P U e) found in 3 5 8 9
3: (P U p) found in 3 4 5 7
4: (P O R X) found in 3 5 9 10
4: (P p W +) found in 3 5 7 9
4: (P U k W) found in 3 4 5 7
4: (P U p W) found in 3 4 5 7
Q: 5 (# A f L d r \ z)
R: 12 (p X W V + G F 6 H @ K ! M J ^ I 7 T t N Q D 5 ) S ( #)
3: (R H D) found in 3 8 10 11
3: (R W D) found in 3 6 10 11
3: (R p )) found in 3 6 7 10
3: (R I )) found in 3 6 7 10
3: (R H 5) found in 3 7 10 11
3: (R H I) found in 3 7 8 10
3: (R p 5) found in 3 6 7 10
3: (R p W) found in 3 6 7 10
3: (R p I) found in 3 6 7 10
3: (R X 5) found in 3 9 10 11
3: (R V 5) found in 3 7 10 11
3: (R 6 5) found in 3 7 10 11
3: (R W 5) found in 3 6 7 10 11
3: (R F 5) found in 3 7 10 11
3: (R + 5) found in 3 7 10 11
3: (R I 5) found in 3 6 7 10
3: (R K 5) found in 3 6 10 11
3: (R + 6) found in 3 7 10 11
4: (R p I )) found in 3 6 7 10
4: (R p W 5) found in 3 6 7 10
4: (R p I 5) found in 3 6 7 10
4: (R + 6 5) found in 3 7 10 11
S: 6 (( # A f l E L d r \ z)
T: 7 (Q # A f L d r \ z)
U: 10 (k O R p X W V + G F 6 H @ K ! q M J ^)
3: (U + 6) found in 3 4 5 9
3: (U p +) found in 3 4 5 7 8
3: (U V +) found in 3 5 7 8 9
3: (U k +) found in 3 4 5 7 8
3: (U + @) found in 3 5 8 9
3: (U W +) found in 3 4 5 7 8 9
3: (U G M) found in 3 6 8 9
3: (U 6 M) found in 3 5 8 9
3: (U R 6) found in 3 4 5 9
3: (U 6 @) found in 3 5 8 9
3: (U W 6) found in 3 4 5 9
3: (U k p) found in 3 4 5 8
3: (U p W) found in 3 4 5 7 8
3: (U V M) found in 3 5 6 9
3: (U K M) found in 3 4 6 9
3: (U k M) found in 3 4 5 6
3: (U R M) found in 3 4 5 9
3: (U H M) found in 3 5 6 9
3: (U W M) found in 3 4 5 9
3: (U F @) found in 3 5 8 9
3: (U k O) found in 2 3 5 7 8
3: (U O R) found in 2 5 8 9
3: (U k V) found in 3 5 7 8
3: (U V @) found in 3 5 8 9
3: (U V H) found in 3 5 6 9
3: (U k R) found in 2 3 4 5 8
3: (U k q) found in 2 3 4 8
3: (U k W) found in 3 4 5 7 8
3: (U W @) found in 3 5 8 9
3: (U W q) found in 3 4 8 9
4: (U k V +) found in 3 5 7 8
4: (U V H M) found in 3 5 6 9
4: (U k p +) found in 3 4 5 8
4: (U k p W) found in 3 4 5 8
4: (U k W +) found in 3 4 5 7 8
4: (U p W +) found in 3 4 5 7 8
4: (U W + 6) found in 3 4 5 9
5: (U k p W +) found in 3 4 5 8
V: 9 (+ G 6 @ K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \)
3: (V G I) found in 2 4 6 8
3: (V G #) found in 2 4 6 8
3: (V t D) found in 2 3 6 8
3: (V T d) found in 2 3 7 8
3: (V T 5) found in 2 3 7 8
3: (V T r) found in 2 3 6 8
3: (V t r) found in 2 3 6 8
3: (V 6 I) found in 2 3 6 8
3: (V I N) found in 2 3 4 6
3: (V I )) found in 2 3 4 6
W: 9 (+ G 6 @ K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \)
3: (W + T) found in 2 4 5 6
3: (W T #) found in 2 4 5 7
3: (W T d) found in 2 4 6 7
3: (W + 6) found in 2 3 4 5
3: (W + E) found in 2 3 4 5
3: (W + N) found in 2 3 4 5
3: (W 6 I) found in 2 4 5 7
3: (W G I) found in 2 4 5 7
3: (W 6 E) found in 2 3 4 5 8
3: (W 6 N) found in 2 3 4 5
3: (W t #) found in 2 4 5 7
3: (W N E) found in 2 3 4 5
3: (W D E) found in 2 3 4 5
3: (W D #) found in 2 4 5 7
3: (W G #) found in 2 4 5 7
4: (W + 6 N) found in 2 3 4 5
4: (W + N E) found in 2 3 4 5
4: (W 6 N E) found in 2 3 4 5
4: (W + 6 E) found in 2 3 4 5
5: (W + 6 N E) found in 2 3 4 5
X: 9 (! 7 T t N Q 5 S ( # A f l E L d r \ 8)
3: (X E L) found in 2 3 4 5
3: (X 5 L) found in 2 3 4 5
3: (X 5 #) found in 2 3 4 5
3: (X 5 E) found in 2 3 4 5
4: (X 5 E L) found in 2 3 4 5
Y: 10 (F 6 H @ K ! q)
Z: 8 (p X W V + G F 6 H @ K ! J I 7 T t N Q D 5 ) S ( # A f l E L)
3: (Z p V) found in 2 4 5 6
3: (Z V T) found in 2 4 5 6
3: (Z V +) found in 2 4 5 6
3: (Z W N) found in 2 3 4 5
3: (Z p N) found in 2 3 4 5
3: (Z I N) found in 2 3 4 5
3: (Z N E) found in 2 3 4 5
3: (Z 6 N) found in 2 3 4 5
3: (Z + N) found in 2 3 4 5
3: (Z K L) found in 2 3 4 7
3: (Z K 5) found in 2 3 4 7
3: (Z p W) found in 2 3 4 5 6
3: (Z W T) found in 2 4 5 6
3: (Z W D) found in 2 3 4 5
3: (Z W E) found in 2 3 4 5
3: (Z W 6) found in 2 3 4 5
3: (Z W +) found in 2 3 4 5 6
3: (Z W 5) found in 2 3 4 6
3: (Z p T) found in 2 4 5 6
3: (Z p I) found in 2 3 4 5
3: (Z p #) found in 2 3 5 6
3: (Z p D) found in 2 3 4 5
3: (Z p E) found in 2 3 4 5
3: (Z p 6) found in 2 3 4 5
3: (Z p )) found in 2 3 4 5
3: (Z p +) found in 2 3 4 5 6
3: (Z p 5) found in 2 3 4 6
3: (Z + T) found in 2 4 5 6
3: (Z I E) found in 2 3 4 5
3: (Z I )) found in 2 3 4 5
3: (Z X 5) found in 2 4 6 7
3: (Z D E) found in 2 3 4 5
3: (Z 6 E) found in 2 3 4 5
3: (Z ) E) found in 2 3 4 5
3: (Z + E) found in 2 3 4 5
3: (Z + 6) found in 2 3 4 5
4: (Z p W 5) found in 2 3 4 6
4: (Z p W N) found in 2 3 4 5
4: (Z p + N) found in 2 3 4 5
4: (Z p 6 N) found in 2 3 4 5
4: (Z p I N) found in 2 3 4 5
4: (Z p N E) found in 2 3 4 5
4: (Z p I )) found in 2 3 4 5
4: (Z p ) E) found in 2 3 4 5
4: (Z p W +) found in 2 3 4 5 6
4: (Z p W 6) found in 2 3 4 5
4: (Z p W D) found in 2 3 4 5
4: (Z p W T) found in 2 4 5 6
4: (Z p W E) found in 2 3 4 5
4: (Z p + 6) found in 2 3 4 5
4: (Z p + T) found in 2 4 5 6
4: (Z p + E) found in 2 3 4 5
4: (Z p 6 E) found in 2 3 4 5
4: (Z p I E) found in 2 3 4 5
4: (Z p D E) found in 2 3 4 5
4: (Z W + N) found in 2 3 4 5
4: (Z W 6 N) found in 2 3 4 5
4: (Z W N E) found in 2 3 4 5
4: (Z + 6 N) found in 2 3 4 5
4: (Z + N E) found in 2 3 4 5
4: (Z 6 N E) found in 2 3 4 5
4: (Z I N E) found in 2 3 4 5
4: (Z V + T) found in 2 4 5 6
4: (Z I ) E) found in 2 3 4 5
4: (Z W + 6) found in 2 3 4 5
4: (Z W + T) found in 2 4 5 6
4: (Z W + E) found in 2 3 4 5
4: (Z W 6 E) found in 2 3 4 5
4: (Z W D E) found in 2 3 4 5
4: (Z + 6 E) found in 2 3 4 5
5: (Z p I ) E) found in 2 3 4 5
5: (Z p W N E) found in 2 3 4 5
5: (Z W + N E) found in 2 3 4 5
5: (Z W 6 N E) found in 2 3 4 5
5: (Z p W + E) found in 2 3 4 5
5: (Z p W 6 E) found in 2 3 4 5
5: (Z p W D E) found in 2 3 4 5
5: (Z W + 6 E) found in 2 3 4 5
5: (Z p W + N) found in 2 3 4 5
5: (Z p W 6 N) found in 2 3 4 5
5: (Z W + 6 N) found in 2 3 4 5
5: (Z p W + T) found in 2 4 5 6
5: (Z p W + 6) found in 2 3 4 5
5: (Z p + N E) found in 2 3 4 5
5: (Z p 6 N E) found in 2 3 4 5
5: (Z p I N E) found in 2 3 4 5
5: (Z + 6 N E) found in 2 3 4 5
5: (Z p + 6 E) found in 2 3 4 5
5: (Z p + 6 N) found in 2 3 4 5
6: (Z p W + N E) found in 2 3 4 5
6: (Z p W 6 N E) found in 2 3 4 5
6: (Z p W + 6 E) found in 2 3 4 5
6: (Z W + 6 N E) found in 2 3 4 5
6: (Z p W + 6 N) found in 2 3 4 5
6: (Z p + 6 N E) found in 2 3 4 5
\: 5 (z c j)
^: 6 (I 7 T t N Q D 5 ) S ( # A f l E)
3: (^ I N) found in 2 3 4 5
3: (^ N E) found in 2 3 4 5
3: (^ I 5) found in 2 3 4 5
3: (^ D 5) found in 2 3 4 5
3: (^ I E) found in 2 3 4 5
3: (^ I )) found in 2 3 4 5
3: (^ I #) found in 2 3 4 5
3: (^ D E) found in 2 3 4 5
3: (^ ) E) found in 2 3 4 5
3: (^ D )) found in 2 3 4 5
3: (^ ) #) found in 2 3 4 5
4: (^ I N E) found in 2 3 4 5
4: (^ I ) E) found in 2 3 4 5
4: (^ I ) #) found in 2 3 4 5
_: 8 ()
c: 6 (j)
d: 6 (r \ z)
e: 10 (G F 6 H @ K ! q)
f: 3 (j _)
j: 2 ()
k: 9 (O R p X W V + G F 6 H @ K ! q M J ^ I)
3: (k V 6) found in 3 5 7 8
3: (k V ^) found in 3 5 7 8
3: (k V G) found in 3 5 7 8
3: (k V +) found in 3 5 7 8
3: (k V I) found in 3 5 7 8
3: (k V M) found in 3 5 7 8
3: (k + 6) found in 3 4 5 7 8
3: (k p 6) found in 3 4 5 8
3: (k W 6) found in 3 4 5 7 8
3: (k 6 I) found in 3 5 7 8
3: (k 6 M) found in 3 5 7 8
3: (k 6 H) found in 3 4 5 8
3: (k + ^) found in 3 5 7 8
3: (k O ^) found in 3 5 7 8
3: (k W ^) found in 3 5 7 8
3: (k ^ I) found in 3 5 7 8
3: (k + G) found in 3 5 7 8
3: (k O G) found in 3 5 7 8
3: (k W G) found in 3 5 7 8
3: (k G I) found in 3 5 7 8
3: (k p +) found in 3 4 5 8
3: (k W +) found in 3 4 5 7 8
3: (k + I) found in 3 5 7 8
3: (k + M) found in 3 5 7 8
3: (k + H) found in 3 4 5 8
3: (k p W) found in 3 4 5 8
3: (k p I) found in 3 4 5 8
3: (k p M) found in 3 4 5 8
3: (k p H) found in 3 4 5 8
3: (k O R) found in 2 3 5 8
3: (k O M) found in 3 5 7 8
3: (k R H) found in 3 4 5 8
3: (k W I) found in 3 5 7 8
3: (k W M) found in 3 4 5 7 8
3: (k W H) found in 3 4 5 8
3: (k K I) found in 3 4 5 8
4: (k V + ^) found in 3 5 7 8
4: (k W + ^) found in 3 5 7 8
4: (k + 6 I) found in 3 5 7 8
4: (k V 6 I) found in 3 5 7 8
4: (k W 6 I) found in 3 5 7 8
4: (k + G I) found in 3 5 7 8
4: (k V G I) found in 3 5 7 8
4: (k W G I) found in 3 5 7 8
4: (k V + I) found in 3 5 7 8
4: (k W + I) found in 3 5 7 8
4: (k p 6 H) found in 3 4 5 8
4: (k + 6 H) found in 3 4 5 8
4: (k W 6 H) found in 3 4 5 8
4: (k + 6 M) found in 3 5 7 8
4: (k V 6 M) found in 3 5 7 8
4: (k W 6 M) found in 3 5 7 8
4: (k p + 6) found in 3 4 5 8
4: (k p W 6) found in 3 4 5 8
4: (k V + 6) found in 3 5 7 8
4: (k W + 6) found in 3 4 5 7 8
4: (k p + H) found in 3 4 5 8
4: (k p W H) found in 3 4 5 8
4: (k W + H) found in 3 4 5 8
4: (k p W M) found in 3 4 5 8
4: (k V + M) found in 3 5 7 8
4: (k W + M) found in 3 5 7 8
4: (k V + G) found in 3 5 7 8
4: (k W + G) found in 3 5 7 8
4: (k p W +) found in 3 4 5 8
5: (k V + 6 M) found in 3 5 7 8
5: (k W + 6 M) found in 3 5 7 8
5: (k V + 6 I) found in 3 5 7 8
5: (k W + 6 I) found in 3 5 7 8
5: (k p W + 6) found in 3 4 5 8
5: (k p W 6 H) found in 3 4 5 8
5: (k p + 6 H) found in 3 4 5 8
5: (k W + 6 H) found in 3 4 5 8
5: (k V + G I) found in 3 5 7 8
5: (k W + G I) found in 3 5 7 8
5: (k p W + H) found in 3 4 5 8
6: (k p W + 6 H) found in 3 4 5 8
l: 5 (L d r \ z)
p: 6 (X W V + G F 6 H @ K ! I 7 T t N Q D 5 ) S ( # A f l E L d r \)
3: (p + E) found in 2 3 4 5
3: (p + N) found in 2 3 4 5
3: (p W +) found in 2 3 4 5
3: (p + 6) found in 2 3 4 5
3: (p D E) found in 2 3 4 5
3: (p ) E) found in 2 3 4 5
3: (p N E) found in 2 3 4 5
3: (p W E) found in 2 3 4 5
3: (p I E) found in 2 3 4 5
3: (p 6 E) found in 2 3 4 5
3: (p W D) found in 2 3 4 5
3: (p I )) found in 2 3 4 5
3: (p W N) found in 2 3 4 5
3: (p I N) found in 2 3 4 5
3: (p 6 N) found in 2 3 4 5
3: (p W 6) found in 2 3 4 5
4: (p W 6 N) found in 2 3 4 5
4: (p + 6 N) found in 2 3 4 5
4: (p 6 N E) found in 2 3 4 5
4: (p W + N) found in 2 3 4 5
4: (p W N E) found in 2 3 4 5
4: (p + N E) found in 2 3 4 5
4: (p I N E) found in 2 3 4 5
4: (p W + 6) found in 2 3 4 5
4: (p W 6 E) found in 2 3 4 5
4: (p + 6 E) found in 2 3 4 5
4: (p W + E) found in 2 3 4 5
4: (p W D E) found in 2 3 4 5
4: (p I ) E) found in 2 3 4 5
5: (p W + 6 N) found in 2 3 4 5
5: (p + 6 N E) found in 2 3 4 5
5: (p W + 6 E) found in 2 3 4 5
5: (p W + N E) found in 2 3 4 5
5: (p W 6 N E) found in 2 3 4 5
6: (p W + 6 N E) found in 2 3 4 5
q: 16 (M J ^ I 7)
r: 7 (\ z c)
t: 7 (Q # A f l E L d r \ z)
z: 4 (j _)
```

## Tuesday, June 14, 2011

### How The Zodiac enciphered the Zodiac 408 cipher

I was looking through the Zodiac Killer ciphers the other day and woke in the middle of the night wondering how The Zodiac actually enciphered the first message (the one that was decoded).

The message consists of 408 symbols; there are 54 different symbols used for the alphabet. So there are multiple symbols for each letter of the alphabet. The Zodiac used a homophonic cipher to disguise the most common letters of the alphabet by using multiple symbols for common letters. For example, for the letter E The Zodiac used seven different symbols.

I started to wonder how when The Zodiac was writing out the message he picked which symbol to use. And it occurred to me that he might have used a really simple system: cycling through the symbols for each letter in the same order.

A quick look at the cipher showed that it was likely that the simple scheme was used. Here I looked at the letter E and the letter N and discovered that a simple pattern was used for each.

Using a small program I wrote I identified the sequence used by The Zodiac for all the repeated letters (note that I've used lowercase letters for the reversed or upside-down capitals used by The Zodiac):
PlaintextCipher symbols in order
EZ p W + ◉ N E
TH I L
AG S
I△ P U k
OX * T d
NO ∧ D ⦶
SF K ▣
HM ⦵
Rt r \
Df z
L B
FJ Q
(In the above table * is The Zodiac's character that looks like pi with curved legs). The Zodiac mostly kept to this scheme with occasional errors (either deliberate or unintentional).

This leads to a possible way to attack the unsolved Zodiac 340 cipher. If The Zodiac used a similar scheme where he repeated the same sequence over and again for each letter it should be possible to find those sequences and reduce the decryption to something close to a classic substitution cipher.

An attack would consist of the following:

1. Split the Zodiac 340 cipher on each of the symbols to obtain a list of lists of sequences

2. Remove any duplicated characters from the lists (since we can assume that there will be none if the characters are being used in order as in the Zodiac 408)

3. Generate all combinations of the first list and look for the same subsequence occurring in the other lists.

Looking at the Zodiac 340 it looks like it splits on average into deduplicated strings of between 20 and 30 symbols. If we look for subsequences of length say 6 then each search would require 38,760 and 593,775 combinations to be generated. For 63 characters that sets an upper bound of roughly 37m combinations. That leads me to think that this approach could be used.

## Thursday, June 09, 2011

### My Email Canary

Despite the fact that I use really long passwords and two-factor authentication wherever it's available I still worry that someone might break into my online accounts. And, my greatest worry is my Google Mail account.

In fact, everyone should be worrying about their online email accounts because they are the Achilles' Heel of your online identity. So much information passes through your personal email that it's a gold-mine for a hacker. Just imagine what could be done with the information on your online email account. Think of all the password reminders and password reset messages: access to your email means that an attacker could likely access many other accounts you own.

So, for my email I built in a canary: a tempting looking email that's sitting in my inbox that's entirely fake and designed to tempt an attacker into clicking on it. Here's a shot of my inbox:

That starred email from "Barclays Private Banking" is entirely fake. If you click it you'll see the following:

And in clicking on it you've activated the canary. The company logo at the bottom is being loaded externally from a private server that I own. On that server a script logs the complete information about the machine that loaded the picture and sends a text message to my phone:

What I wonder is if there's a commercial monitoring service that could be made out of this idea. For example, a service could insert canary images into online services and monitor when the canary is activated looking for odd behaviour. Clearly, it would require the cooperation of the vendors of online services to make it work, but perhaps that can be worked out with some sort of revenue share.

WDYT?

## Thursday, June 02, 2011

### Plan 28: June 2011 Update

It's been a while since I gave an update on Plan 28. I apologize for the long silence. The wheels of British bureaucracy turn slower than the gears of the Difference Engine No.2 being driven by a field mouse.

The current status is:

1. Doron and I continue to work on the project. We have assembled a team of trustees and the paperwork for the creation of an official "Plan 28" charity is in progress.

2. We have been working closely with The Science Museum and the Computer Conservation Society to ensure that the project runs smoothly and has the maximum support (in terms of expertise) once it kicks off.

I hope that by July (at the latest) I will be able to make concrete announcements about the project's progress and timeline, and to be able to start to receive donations.

In case you missed it, Wired Magazine published an article about the project called A £400,000 PC downgrade: Rebooting Babbage’s Analytical Engine.

## Wednesday, June 01, 2011

### How to break the New Scientist cipher puzzle (part 3)

New Scientist had a little cipher challenge with four ciphers that needed breaking. The hardest of which (at least for me) was part 3. It's a form of transposition cipher where the letters are simply juggled around.

Here's the cipher text:
```EUINRECSTNCIHRLYYEORYNDPUPTAIPTSNIONOUEIODMNTHIBTN
THETESSREECWOEECLFOHNRPFRESRLIQDIHCYONOUEFCUOFLICS
ERPDTHNLYVOPEOEKTSTLVOTBEYEHGEDRERTHEMASLPOQISUSHO
WYTIPRRIWLYHMEINDPEOVNOTCIORAERTTBPLEATTHHNSEIETEE
CEPCSJRRNENDIEUSTNOTUFCBTAUITRIHPTSRTLEESNEHELESIA
UNTSEVTAEGUTTRANEEESTEDNTTGTNEKTHTODHAHERCTSAYHTEC
KNHOASUETHOUMLITDERFFYTIWANHHSREOSSTTDPEVUOEHEAFBO
LLEDN
```
There are exactly 355 characters there, and 5 is a divisor of 355 so write out the characters in blocks of 5:
```E U I N R
E C S T N
C I H R L
Y Y E O R
Y N D P U
P T A I P
T S N I O
N O U E I
O D M N T
H I B T N
T H E T E
S S R E E
C W O E E
C L F O H
N R P F R
E S R L I
Q D I H C
Y O N O U
E F C U O
F L I C S
E R P D T
H N L Y V
O P E O E
K T S T L
V O T B E
Y E H G E
D R E R T
H E M A S
L P O Q I
S U S H O
W Y T I P
R R I W L
Y H M E I
N D P E O
V N O T C
I O R A E
R T T B P
L E A T T
H H N S E
I E T E E
C E P C S
J R R N E
N D I E U
S T N O T
U F C B T
A U I T R
I H P T S
R T L E E
S N E H E
L E S I A
U N T S E
V T A E G
U T T R A
N E E E S
T E D N T
T G T N E
K T H T O
D H A H E
R C T S A
Y H T E C
K N H O A
S U E T H
O U M L I
T D E R F
F Y T I W
A N H H S
R E O S S
T T D P E
V U O E H
E A F B O
L L E D N
```
If you stare that this you'll see some words appear. In fact, the third column reads (downwards) ISHEDANUMBEROFPRINCIPLESTHEMOSTIMPORTANTPRINCIPLES
TATEDTHATTHEMETHODOFE
or ISHED A NUMBER OF PRINCIPLES THE MOST IMPORTANT PRINCIPLE STATED THAT THE METHOD OF E. So, switch the columns around into rows for easier readability.
```EECYYPTNOHTSCCNEQYEFEHOKVYDHLSWRYNVIRLHICJNSUAIRSLUVUNTTKDRYKSOTFARTVEL
UCIYNTSODIHSWLRSDOFLRNPTOEREPUYRHDNOTEHEERDTFUHTNENTTEEGTHCHNUUDYNETUAL
ISHEDANUMBEROFPRINCIPLESTHEMOSTIMPORTANTPRINCIPLESTATEDTHATTHEMETHODOFE
NTROPIIENTTEEOFLHOUCDYOTBGRAQHIWEETABTSECNEOBTTEHISERENNTHSEOTLRIHSPEBD
RNLRUPOITNEEEHRICUOSTVELEETSIOPLIOCEPTEESEUTTRSEEAEGASTEOEACAHIFWSSEHON
```
Now for a guess. Guess that that final E on line three is the start of the word ENCRYPTION and that the N on the next line is the next letter. Is it possible to find the complete word? Yes, by following a zig zag pattern. To make this easier rearrange the rows.
```EECYYPTNOHTSCCNEQYEFEHOKVYDHLSWRYNVIRLHICJNSUAIRSLUVUNTTKDRYKSOTFARTVEL
ISHEDANUMBEROFPRINCIPLESTHEMOSTIMPORTANTPRINCIPLESTATEDTHATTHEMETHODOFE
NTROPIIENTTEEOFLHOUCDYOTBGRAQHIWEETABTSECNEOBTTEHISERENNTHSEOTLRIHSPEBD
UCIYNTSODIHSWLRSDOFLRNPTOEREPUYRHDNOTEHEERDTFUHTNENTTEEGTHCHNUUDYNETUAL
RNLRUPOITNEEEHRICUOSTVELEETSIOPLIOCEPTEESEUTTRSEEAEGASTEOEACAHIFWSSEHON
```
The bolded characters form the sentence NCRYPTION ITSELF SHOULD NOT BE REQUIRED TO BE SECRET BUT THE STRENGTH SHOULD INSTEAD and the non-bolded zig zag characters read UTIONISED THE WORLD OF CRYPTOGRAPHY WHEN AT THE END OF THE NINETEENTH CENTURY HE PUBL.

That just leaves two lines of cipher:
```EECYYPTNOHTSCCNEQYEFEHOKVYDHLSWRYNVIRLHICJNSUAIRSLUVUNTTKDRYKSOTFARTVEL
RNLRUPOITNEEEHRICUOSTVELEETSIOPLIOCEPTEESEUTTRSEEAEGASTEOEACAHIFWSSEHON
```
Again the zig zag pattern applies and it's possible to read RELY UP ON THE SECRECY OF THE KEY THIS PRINCIPLE IS JUST AS RELEVANT TODAY AS IT WAS THEN and ENCRYPTION TECHNIQUES EVOLVED SLOWLY OVER THE CENTURIES AUGUSTE KERCKHOFFS REVOL

Put it all together and you have: ENCRYPTION TECHNIQUES EVOLVED SLOWLY OVER THE CENTURIES AUGUSTE KERCKHOFFS REVOLUTIONISED THE WORLD OF CRYPTOGRAPHY WHEN AT THE END OF THE NINETEENTH CENTURY HE PUBLISHED A NUMBER OF PRINCIPLES THE MOST IMPORTANT PRINCIPLE STATED THAT THE METHOD OF ENCRYPTION ITSELF SHOULD NOT BE REQUIRED TO BE SECRET BUT THE STRENGTH SHOULD INSTEAD RELY UPON THE SECRECY OF THE KEY THIS PRINCIPLE IS JUST AS RELEVANT TODAY AS IT WAS THEN.

PS Hot on the heels of this post is the official answer from New Scientist which also revealed that I was one of the winners. They also explain the actual technique used for part 3. I broke it without spotting the simple pattern that makes it work and by making a 'lucky' guess.

### Making an old USB printer support Apple AirPrint using a Raspberry Pi

There are longer tutorials on how to connect a USB printer to a Raspberry Pi and make it accessible via AirPrint but here's the minimal ...