Anoraks Corner by Tony Sale Some hints on how to break this Lorenz?

| Back to Lorenz Scenarios |

Tony Sale's
Codes and Ciphers

Scenario 3.

Before trying this you should read the introduction to Virtual Colossus.
This scenario is an intercept of 5668 characters accessed in Virtual Colossus as "KHcipher" and "KHpatterns". It needs the K2 one-back limitation set.

1. Getting started.

Click on the "cipher?" drop down menu on the far left hand side. Select "KHcipher". Ignore "starts?" for the moment and click on "pattern?". Select "KHpattern". This takes anything up to 15 seconds to load. When it has loaded zeros appear in the Counts box and the vertical sliders can be moved.

For starters check the cipher text length. On the left hand big switch panel click underneath the first counter switch on the top row to set it down. Now scroll left the big right hand panel to show the three big black ganged switches. Click above the top ganged switch to set it up and to switch the cipher characters, Z, to the Q bus on the big switch panel. Now continue scrolling the right hand panel to reveal the master switch panel. Click underneath the black with "LC" (letter count) above it. This should result in 2042 appearing as the left hand (No 1 counter) count in the Counts box. Now click the counter key back up to horizontal.

2. Setting X1 and X2.

We are going to first set X1 and X2 using the "double delta" algorithm. This requires DeltaZ to be added to DeltaX and put on the Q bus. So scroll back to the three big ganged switches and set the top and middle keys down to get DeltaZ and DeltaX added onto the Q bus.

Now turn to the left hand big switch panel and scroll it up tp show the rows of red keys. We are going to run the "1+2=." algorithm so on the top left hand row of red keys put down 1 and 2 (reading from the left). This "adds" track 1 and 2 coming down the Q bus and sends the result right towards the counter switches, the red switches on the left. But we have to set the right hand yellow switch up to "dot" to enforce only counting when the result = dot. Now set down the first of the red counter switches to put the result into counter 1.

Now we need to try all possible pattern start postions for X1 and X2 to find the highest score of the algorithm which should reveal the correct start positions fo this cipher text. To do this, scroll the right hand display panel to show the master switch panel. On the lower row of switches at the left hand side are the stepping control switches. Set switch 1 down and switch 2 up. This tells Colossus to step the X1 start position forward after every pass through the cipher text, and to step X2 when X1 has done a complete cycle of its start postions. 3. Set Totals. The next thig to set is the "Set Total" switches. By setting these only counts greater than, or less than, the Set Total will be printed out, thus significantly reducing printout. But first the Set Total must be calculated. This requires a bit of maths. We found that the cipher length, n = 2042. We are using two elements of the 5 in the Baudot characters, X1 and X2, so the expected random score is half n, i.e. 1021. The standard deviation(sigma) of this is 1/2(sqroot(n)) = 22.6 For a 1+2=. run the Set Total was usually set to 2.5 times sigma up on the random score. This is 1021+56 = 1077. To set this in, scroll up the right hand panel to reveal the verticle column of rotary switches for Thousands, Hundreds, Tens and Units. By clicking on the arrows to the right of the switches, rotate them until 2 shows on the Thousands, 9 on the Hundreds etc.

(Health Warning!! the hit boxes on the rotate arrows don't always work properly causing the right hand panel to revert to zero offset. If it does this, when you scroll back to the Set Total switches check that the "revert to zero" has not caused any of them to change from their set postion!! Make absolutely sure that the dials show the correct Set Total before leaving!!)

Click underneath the "M" key, top row right, on the master swtich panel to start the run. The printout window will appear with K1 K2 count as the heading. Say "no" to the slow running abort Alert panel when it appears.
(The run takes about 20 minutes on an 800Mhz PC)

What comes out is:
K1 . K2 . count
31 .. 1 . 1087
.5 .. 3 . 1095
20 .. 6 . 1080
.8 .. 7 . 1079
20 .. 9 . 1082
34 . 17 . 1083

top counts at K1=31, K2=1 = 1087 = 3xsigma
K1=5, K2=3 = 1095 = 3.4xsigma.

so more runs would be needed to prove or disprove which one is correct.

The run to set K4 and K5 given K1 and K2 is 4=5=/1=2 this needs to be run for both the two contending K1, K2 settings

4. The X4 and X5 run.

So now scroll the right hand panel to show the "starts" plug panel. First look at the X1=31, X2=1 contender. At present all starts are set to 1 so now move the start of X1 to 31. The jack sockets are not exact, the important thig is to have the numbers 31 and 1 in the starts box in the top panel display. The next thing is to set wheels X4 and X5, given X1 and X2. The BP algorithm for this was: 4=5=/1=2. The "/" means everything to the right is "given".

First clear all the red and yellow keys in the bottom half of the big switch panel. Now scroll up to the top half, the black keys on the left hand side. On the first row push down keys 1, 2, 4 and 5 leaving key 3 horizontal. This will give a "true" result when bits 1, 2, 4 and 5 on the Q bus are = cross with bit 3 ignored and this result can be switched into counter 1 by putting down the left hand grey counter key. But what we actually want is a count when either the selected Q bus bits are all dot OR all crosses. To get this final result, set the second row of black keys 1, 2, 4 and 5 up to match on dots on the Q bus. Now a cleaver bit of Boolean logic: A OR B = NOT( NOTA + NOTB), so press down the yellow negate key just to the left of the counter key on both the two rows and finally at the bottom of the set of counter keys is a rowof yelliw keys which negate the whole counter output, set down the left hand yellow key to negate the output of counter 1. The result of all this is that counter 1 will count every instance of 4=5=/1=2 down the whole length of the cipher text.

Now we need to set which wheels are to have their starts incremented. Scroll the right hand panel to show the master switch panel. Reset lower row black keys 1 and 2 and then put down key 4 and up key 5. This means X4 will step after every travers of the cipher text but X5 will only step for every completion of the X4 starts. (26 x 23 = 598 runs through the cipher text).

Next what should the Set Total be? The expected random score for 4 elements out of 5 is n/8 which gives 255. The sigma is 1/4 sqrt(3 x n) = 20 so Set Total should be random + 2.5 sigma = 305. So put this onto the Set Total rotary switches, then scroll the right hand panel to show the right hand side of the master switch panel and click down the "M" key to start the run. The print out window should now show K4 K5 count on its top line and print out the scores. Again say "no" to the abort Alert panel.

first for K1=31, K2=1 then for K1=5, K2=3

K5 . K4 . count ... K5 . K4 . count
15 . 1 ... 315 .....14 ..16 . 307
24 .16 ... 309

These results re-inforce K1=31, K2=1 as the correct settings, but leave three contenders for K5, K4. The setting runs for K3 resolve these.

5. Now set X3.

So finally set X3 on a count of /// given 1 2 4 and 5.

Scroll to the top of the big switch panel. Put up key 3 on the top row, centre the negate key, leave the counter 1 key down and centre all other keys. the top row will now detect a "/" character (all dots) and if found count it into counter 1. Scroll down and centre the yellow counter negate key. Now get the master switch panel in the right hand window. On the bottom row centre keys 4 and 5 then put down key 3.

Now we need to Set Total. The expected random score is n/32 = 64. sigma = 1/8 sqrt(3 x n) = 10 so put Set Total to random + 2.5 sigma = 89.

Now press down the "M" key and do the run. The output window appears with K3 count on the first line and counts come out for ///.

Count of "/" given K1, K2, K4 and K5 set total 89

K4=15, K5=1 .... K4=24, K5=16 ..... K4=14, K5=16

K3 . count ...... K3 . count ....... K3 . count

1 .. 91 ........... none ............. none
20 . 92

So this confirms K4=15, K5=1 and leaves two contenders for K3

6. A further K3 run.

3x/1x4x is another K3 run. This is set up on the red + keys, lower left on the big switch panel. On the first row put down key 3, down the yellow key to test for x and switch into counter 1.

On the next ro put down key 1 and down the yellow key to test bit 1 for x, putting the result also into counter 1. Lastly put down key 4 on the third row, put its yellow key up to test for dot and put the result into counter 1 as well.

Now make sure that the black K3 key is down to make K3 go through all its starts and press down "M" to do the run.

This gives a maximum of 289 at K3 = 1, confirming this as the correct setting.
This confirms K1=31, K2=1, K3=1, K4=15, K5=1 as the settings for this cipher text.

7. Now for the Motor wheels.

Next comes the setting of the Motor wheels M1 and M2.

This can usually be achieved by counting the number of "/" characters in the Delta deChi at all places where Total Motor = x. (remember total Motor is the basic motor, BM, caused by a "x" in M2 plus any limitation such as in this case, X2 one back).

To set the motor wheels first put a "/" character, all dots (0) onto the top row of black switches, first row on the Q bus on the big switch panel. Set down the first counter switch on this row to add the result of finding a "/" into counter 1.

Now scroll to the bottom of the big switch panel and set down to "x" the yellow TM switch. This causes the Total Motor signal to only allow counting when Total Motor is an "x".

Moving to the right hand panel, scroll across to the big ganged switch panel and put down the Z and X switches to add Delta Z and Delta X. ie to get Delta deChi onto the Q bus. On the row of Limit control switches uder the ganged switches, put down the centre key to enable the X2 one-back limitation.

Scroll to the master switch panel and put down key M1 on the bottom row, just to the right of the red X4 key. The next black key is M2 and put this up. This means that M1 will step after every run through the cipjher text but M2 will only step after M1 has gone through all its start positions.

Make sure that the M1 and M2 start positions are at 1 and scroll to the Set Total switches.

8. Set Total for motor runs.

To caculate the Set Total, first scroll the switch panel up and set up the top counter 1 switch, put down the counter 1 switch on the next row down. Since no keys are set on the Q bus, every character of the cipher text is counted. With the TM switch centred, press the LC key. Counter 1 shows 2042 the total length of the cipher text. Now put down TM and do LC again. Now counter 1 shows 644, the number of places down the cipher text where Total Motor = "x". The random score is 644/32 approximately 20. The sigma is 1/8(sqrt(7 x 644) = 8. The motor wheels usually set at about 2 sigma, so a Set Total of 36 should be set.

9. A cheat way using "10"!

The next problem is the length of run needed to examine all M1 and M2 start postions, 61 x 37 = 2257. This takes about 30 minutes on an 800 Mhz PC and you have to keep watching for IE slow running Alerts! A cheating method is to know that the correct start positions for the KHcipher text are M1=59 and M2=26. This is where the "10" switch on the master switch panel comes in. By putting this down only 10 start positions will be explored. So set M1 to start at 54 and put M2 at 26. Now after returning the big switch panel top row to counter 1 and clearing the second row, press down the "M" switch on the master switch panel. This will bring up the print-out panel and show the counts + - 5 of the correct setting.

If this has given you confidence that it will work you can now do the full run by setting M1 and M2 starts back to 1, centering the "10" switch and pressing "M" again. Watch out for Alerts!! This run is however inconclusive. There are lots of high scores around 42 with no clear winner.

The Newmanry report (23L) suggests trying a minimum count rather than a maximum count. The least frequent character in the DeChi is "B". To count this set the "B" pattern (x..xx) into row of black keys and switch the result into counter 1. We now need the Printout to only show counts LESS than the Set Total. The Set Total should be 1.5 sigma less than the random score, ie. 8 and the top black key on the right hand side of the Set Total panel needs to be set to the left for less than.

This Motor setting run again takes about 30 minutes and shows 6 low counts of 6. M1/M2: 50/3 47/9 55/9 2/25 59/26 and 34/32

These can be resolved by attempting to set the Psis on each of them in turn.

10. Setting the Psi wheels.

Setting the S wheels requires the direct Z, X and S signals switched onto the Q bus, not the Deltas as used for X and M setting. Any limitations must be set, in this case the X2 one-back limitation.

The most common character in the plain language text is usually "space", 00100 in Baudot code, thus checking for maximum count of 1+2=. 3=x and 4+5=. should set the Psis.

S1 and S2 can be set first by doing 1+2=. on the red keys, just like for setting X1 and X1.

On the master switch panel set down the lower black S1 key and set up the S2 key so that S1 start increments after each traverse of the cipher text and S2 moves on only after S1 has gone through all its starts.

Again Set Total needs to be set and since two elements are being investigated this can be 1077 as for X1 and X2. So scroll the right hand Colossus panel to the Set Total rotary switches and set them to 1077. (remember to clear the "less than" key if you have used it)

Set the M1 and M2 starts to the first set to be tried.

Now press down the "M" key top right hand of the master switch panel.

The complete run will take about 30 minutes on a 800 Mhz PC. The printout will only show a clear maximum count of over 1200 when the correct M1 M2 starts are used. The maximum is at S1 = 32, S2 = 36.

Now set S4 and S5 by using 4+5=. Scroll the big switch panel down to bottom left. Centre the top row 1 and 2 red Qbus keys and put down 3 and 4. Scroll the right hand panel to show the master switch panel. Centre the lower row S1 and S2 keys and put S4 down and S5 up to increment the S4 start position every traverse of the cipher text and S5 only when S4 has done all positions.

Now press the "M" key to do the run. Now the printout shows a clear maximum count at S4 = 9, S5 = 43.

Finally set S3 by counting 3=+ Centre red keys 4 and 5 on the top row of red Q bus keys and put down red key 3. Move right along this top row to the yellow key which should have been set to "dot" for the previousruns. Centre it then put it down to count "x". Change the S start increment keys on the master switch by centering S4 and S5 and putting down S3. This will just take the S3 ring through all its start positions. The same Set Total can be used and a maximum count shows at S3 = 11.

Finally, set the S start positions to S1 = 32, S2 = 36, S3 = 11, S4 = 9 and S5 = 43. M1 should be at 59 and M2 at 26.

11. A test deciphering.

With all the other ring starts set correctly, try deciphering the cipher text.

Check that you have all the big black keys set up to Direct not down to Delta. On the master switch panel press down the "SU" key to set everything up. Now press down the "T" for Trace key. The top test panel boxes will be filled up with Z, X, S and Q bit patterns. Also shown are the Baudot characters corresponding to the bit patterns. The first character read from the tape, (in the Z box) is "J". Also shown is the deciphered character in the Q box, which is "X". This output was not available on real Colossus. On real Colossus the operator set spanning to one character and switched the Q bus bits to the five counters. The bit pattern of the deciphered character could then be read from the counter outputs and the character looked up in the teleprinter code chart.

So now by repeated pressing of the "T" key, successive characters of the decipher should appear in the Qbus box as:
XWOLLE.WI.R..AUCH

Read the introduction to Virtual Tunny, then after selecting the cipher, KHcipher and the patterns, KHpatterns, set in the wheel start positions you have just found and decipher the cipher text.

You may need to print this then go look for tools.

 This page was originally created by the late Tony Sale, the original curator of the Bletchley Park Museum,