Hagelin M-209: Reconstruction of the internal setting ===================================================== METHOD used (derived from MORRIS'): 1) Identify the wheels with the largest number of lugs front of them and deduce their pins. If we solve two wheels, that's enough. 2) Suppress ambiguity between 0/26 and 1/27 (before this step, we should not use the key values 0 and 1). 3) From the previous step we deduce the positions for which we have all the pins to 0 and the positions for which we have all the pins 1 (sum = 27). 4) we deduce (if known key is long enough [300]) key values for some pins configuration [001 ** 1], [** 0000], etc. .... We can deduce the value of the lugs front of each wheel. Then we can deduce overlays. 5) We create the array of 64 possible pins combinations and deduced for each key value corresponding pins combinations (those where there is only one possibility is most useful). Then each key value is analyzed and deduced (so laborious) new value pines. From time to time these new deductions are used to analyze with more information each key value (iterative process). 6) Verification: Recalculate possible key values for each combination of pins ([000000] [000001] [000010], ...). We should find a key value for each. Finally we try to decipher the message via the calculated key. Remarks 1) To find the pins of an additional wheel (after step 1), we can try to remove the effects of pins wheels found on the displacements of the other wheels. Different sets are created for the ping "+" and pin "-" (but it reduces the size of the sample each time by a factor of 2!). 2) for each wheel, we can calculate minimum and maximum column values key. Are not taken into account (at the beginning) the values 0 and 1 (which can be worth 26 and 27). Cipher text: ============ UJRMH ECAAU GYJNR SCPFX EKOVO PLOFK XGCFE UUXBN NGEHJ ZWOWF TRSCT REIUV JBUPF SOURZ BRGBO GJRAP CZOBG YWUGE DRSGU OFIPL OFDPC TMHLT KWWLL JOTBE OJTUL XAAAK CZZAI FYQQU NMNDN FWKQJ DPPLH GLABY PUYME KADBG OBATE ZNWJU CZCHZ ASUBU NSBBI RBCSZ ALDRN CAQWU QNLBQ RULHR PXPFM CQCXW JFLYQ BROIN JQGJS ZLLCJ KETQB PXNWV AOPJM QITGI YFGGH AXNNY QHVMK XVULW BKLHF EOQLX SHVGR LTFZZ KLFSP RGPXD VLNAE NWJSD AOZUN YTBCE MTLDL ARMDL AZ Plain text: =========== THE INFANTRY COMMANDERS DID NOT KNOW THAT THE GUNS HAD BEEN MOVED PRIOR TO THE ATTACK COMMA THEY HAD TO PRESS FARTHER INLAND TO FIND THEM AND EVENTUALLY DESTROY THEM STOP HOWEVER COMMA THE FORTIFICATIONS THEMSELVES WERE STILL VITAL TARGETS AS A SINGLE ARTILLERY FORWARD OBSERVER BASED THERE COULD HAVE CALLED DOWN ACCURATE FIRE ON THE US BEACHES STOP Key: ==== The encryption formula of the M-209 is: cipher_letter = ((key + 25) - plain_letter) 26% A = 0, B = 1, C = 2, ...,% means "modulo" , 25 = -1 % 26 We deduce the key: key = (cipher_letter + plain_letter + 1)% 26 Key[0] = U + T + 1 = 20 + 19 + 1 = 40 % 26 = 14 Key[1] = J + H + 1 = 9 + 7 + 1 = 17 Key[2] = R + E + 1 = 17 + 4 + 1 = 22 and so on ... 14 17 22 12 16 18 8 1 14 14 24 23 9 16 6 5 15 16 19 1 9 2 7 21 18 24 15 14 19 25 17 6 13 19 19 17 20 17 9 14 7 6 24 15 14 25 3 9 10 24 19 25 19 6 19 19 9 13 8 21 22 16 16 20 9 18 4 12 0 14 19 17 0 16 14 0 17 22 0 16 22 19 15 4 17 24 25 9 19 17 4 17 12 14 25 13 5 16 16 15 14 25 18 15 18 11 17 0 4 19 16 23 14 5 19 14 6 19 10 18 0 10 7 24 11 17 15 0 6 19 16 3 25 20 16 10 11 16 17 8 17 12 18 25 18 19 16 5 17 21 15 14 15 15 12 25 5 18 16 23 15 14 6 17 17 10 19 23 16 22 14 9 15 16 9 21 18 14 9 23 17 12 15 8 25 0 12 2 6 20 19 7 19 21 17 23 10 5 19 19 9 0 17 10 13 22 8 21 9 13 21 25 7 6 9 17 17 16 25 22 15 16 9 14 24 14 16 24 6 16 10 17 11 18 17 19 24 19 2 6 9 17 25 9 19 25 4 20 16 16 22 9 19 17 19 9 6 25 8 0 18 13 15 15 1 8 5 20 24 12 24 20 8 25 12 18 19 18 5 24 18 8 14 17 14 23 15 2 16 14 6 10 14 22 0 16 18 16 19 24 14 12 21 9 18 23 5 10 3 25 14 0 2 6 15 18 9 18 18 21 22 5 18 0 10 22 14 14 18 18 14 14 19 2 18 24 14 20 2 6 17 20 14 11 16 19 17 5 23 0 16 25 Print the key with period 26: 14 17 22 12 16 18 8 1 14 14 24 23 9 16 6 5 15 16 19 1 9 2 7 21 18 24 15 14 19 25 17 6 13 19 19 17 20 17 9 14 7 6 24 15 14 25 3 9 10 24 19 25 19 6 19 19 9 13 8 21 22 16 16 20 9 18 4 12 0 14 19 17 0 16 14 0 17 22 0 16 22 19 15 4 17 24 25 9 19 17 4 17 12 14 25 13 5 16 16 15 14 25 18 15 18 11 17 0 4 19 16 23 14 5 19 14 6 19 10 18 0 10 7 24 11 17 15 0 6 19 16 3 25 20 16 10 11 16 17 8 17 12 18 25 18 19 16 5 17 21 15 14 15 15 12 25 5 18 16 23 15 14 6 17 17 10 19 23 16 22 14 9 15 16 9 21 18 14 9 23 17 12 15 8 25 0 12 2 6 20 19 7 19 21 17 23 10 5 19 19 9 0 17 10 13 22 8 21 9 13 21 25 7 6 9 17 17 16 25 22 15 16 9 14 24 14 16 24 6 16 10 17 11 18 17 19 24 19 2 6 9 17 25 9 19 25 4 20 16 16 22 9 19 17 19 9 6 25 8 0 18 13 15 15 1 8 5 20 24 12 24 20 8 25 12 18 19 18 5 24 18 8 14 17 14 23 15 2 16 14 6 10 14 22 0 16 18 16 19 24 14 12 21 9 18 23 5 10 3 25 14 0 2 6 15 18 9 18 18 21 22 5 18 0 10 22 14 14 18 18 14 14 19 2 18 24 14 20 2 6 17 20 14 11 16 19 17 5 23 0 16 25 Print the keys with period 25 14 17 22 12 16 18 8 1 14 14 24 23 9 16 6 5 15 16 19 1 9 2 7 21 18 24 15 14 19 25 17 6 13 19 19 17 20 17 9 14 7 6 24 15 14 25 3 9 10 24 19 25 19 6 19 19 9 13 8 21 22 16 16 20 9 18 4 12 0 14 19 17 0 16 14 0 17 22 0 16 22 19 15 4 17 24 25 9 19 17 4 17 12 14 25 13 5 16 16 15 14 25 18 15 18 11 17 0 4 19 16 23 14 5 19 14 6 19 10 18 0 10 7 24 11 17 15 0 6 19 16 3 25 20 16 10 11 16 17 8 17 12 18 25 18 19 16 5 17 21 15 14 15 15 12 25 5 18 16 23 15 14 6 17 17 10 19 23 16 22 14 9 15 16 9 21 18 14 9 23 17 12 15 8 25 0 12 2 6 20 19 7 19 21 17 23 10 5 19 19 9 0 17 10 13 22 8 21 9 13 21 25 7 6 9 17 17 16 25 22 15 16 9 14 24 14 16 24 6 16 10 17 11 18 17 19 24 19 2 6 9 17 25 9 19 25 4 20 16 16 22 9 19 17 19 9 6 25 8 0 18 13 15 15 1 8 5 20 24 12 24 20 8 25 12 18 19 18 5 24 18 8 14 17 14 23 15 2 16 14 6 10 14 22 0 16 18 16 19 24 14 12 21 9 18 23 5 10 3 25 14 0 2 6 15 18 9 18 18 21 22 5 18 0 10 22 14 14 18 18 14 14 19 2 18 24 14 20 2 6 17 20 14 11 16 19 17 5 23 0 16 25 Print average and histogram: Wheel 26 -------- 000 : 12.69 ! 14 15 19 0* 18 16 5 15 9 17 18 15 2 2 001 : 10.86 ! 17 14 6 16 11 3 18 8 13 19 13 2 6 6 002 : 19.50 ! 22 19 19 22 17 25 16 25 21 24 15 16 15 17 003 : 19.08 ! 12 25 19 19 0* 20 23 0* 25 19 15 14 18 20 004 : 10.92 ! 16 17 9 15 4 16 15 12 7 2 1* 6 9 14 005 : 10.36 ! 18 6 13 4 19 10 14 2 6 6 8 10 18 11 006 : 11.14 ! 8 13 8 17 16 11 6 6 9 9 5 14 18 16 007 : 19.69 ! 1* 19 21 24 23 16 17 20 17 17 20 22 21 19 008 : 19.38 ! 14 19 22 25 14 17 17 19 17 25 24 0* 22 17 009 : 10.64 ! 14 17 16 9 5 8 10 7 16 9 12 16 5 5 010 : 20.00 ! 24 20 16 19 19 17 19 19 25 19 24 18 18 23 011 : 19.17 ! 23 17 20 17 14 12 23 21 22 25 20 16 0* 0* 012 : 11.43 ! 9 9 9 4 6 18 16 17 15 4 8 19 10 16 013 : 20.43 ! 16 14 18 17 19 25 22 23 16 20 25 24 22 25 014 : 11.23 ! 6 7 4 12 10 18 14 10 9 16 12 14 14 015 : 12.46 ! 5 6 12 14 18 19 9 5 14 16 18 12 14 016 : 19.82 ! 15 24 0* 25 0* 16 15 19 24 22 19 21 18 017 : 13.54 ! 16 15 14 13 10 5 16 19 14 9 18 9 18 018 : 13.15 ! 19 14 19 5 7 17 9 9 16 19 5 18 14 019 : 20.55 ! 1* 25 17 16 24 21 21 0* 24 17 24 23 14 020 : 13.00 ! 9 3 0* 16 11 15 18 17 6 19 18 5 19 021 : 10.92 ! 2 9 16 15 17 14 14 10 16 9 8 10 2 022 : 11.38 ! 7 10 14 14 15 15 9 13 10 6 14 3 18 023 : 21.64 ! 21 24 0* 25 0* 15 23 22 17 25 17 25 24 024 : 13.54 ! 18 19 17 18 6 12 17 8 11 8 14 14 14 025 : 20.36 ! 24 25 22 15 19 25 12 21 18 0* 23 0* 20 * * * * * * * * * * * * * * * * * * * * * * * * * * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 The histogram is bimodal. There is a good reason for this. If the ith pin on the wheel 26 is inactive then the average displacement comes from the five other wheels. But if the ith pin is active, the average displacement includes the contribution the wheel 26 (IE: the number of lugs front of it). Then we can deduce the pins setting of the wheel. Wheel 25 -------- 000 : 17.07 ! 14 24 19 0* 14 17 15 21 9 14 22 18 14 22 16 001 : 17.21 ! 17 15 25 17 25 15 14 18 0* 16 9 19 12 14 25 002 : 18.23 ! 22 14 19 22 18 0* 15 14 17 24 19 18 21 14 003 : 11.31 ! 12 19 6 0* 15 6 15 9 10 6 17 5 9 18 004 : 18.29 ! 16 25 19 16 18 19 12 23 13 16 19 24 18 18 005 : 17.21 ! 18 17 19 22 11 16 25 17 22 10 9 18 23 14 006 : 9.79 ! 8 6 9 19 17 3 5 12 8 17 6 8 5 14 007 : 16.58 ! 1* 13 13 15 0* 25 18 15 21 11 25 14 10 19 008 : 10.71 ! 14 19 8 4 4 20 16 8 9 18 8 17 3 2 009 : 18.54 ! 14 19 21 17 19 16 23 25 13 17 0* 14 25 18 010 : 19.00 ! 24 17 22 24 16 10 15 0* 21 19 18 23 14 24 011 : 18.08 ! 23 20 16 25 23 11 14 12 25 24 13 15 0* 14 012 : 11.00 ! 9 17 16 9 14 16 6 2 7 19 15 2 2 20 013 : 11.14 ! 16 9 20 19 5 17 17 6 6 2 15 16 6 2 014 : 12.31 ! 6 14 9 17 19 8 17 20 9 6 1* 14 15 6 015 : 12.07 ! 5 7 18 4 14 17 10 19 17 9 8 6 18 17 016 : 11.71 ! 15 6 4 17 6 12 19 7 17 17 5 10 9 20 017 : 17.86 ! 16 24 12 12 19 18 23 19 16 25 20 14 18 14 018 : 17.62 ! 19 15 0* 14 10 25 16 21 25 9 24 22 18 11 019 : 18.17 ! 1* 14 14 25 18 18 22 17 22 19 12 0* 21 16 020 : 18.69 ! 9 25 19 13 0* 19 14 23 15 25 24 16 22 19 021 : 10.86 ! 2 3 17 5 10 16 9 10 16 4 20 18 5 17 022 : 10.77 ! 7 9 0* 16 7 5 15 5 9 20 8 16 18 5 023 : 18.15 ! 21 10 16 16 24 17 16 19 14 16 25 19 0* 23 024 : 16.69 ! 18 24 14 15 11 21 9 19 24 16 12 24 10 0* * * * * * * * * * * * * * * * * * * * * * * * * * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Pins setting for wheels 26 and 25: 25 [ + + + - + + - + - + + + - - - - - + + + + - - + + ] 26 [ - - + + - - - + + - + + - + - - + - - + - - - + - + ] True values for keys equal 0 or 1: ================================== Position - key value >>> 7 >>> 27 7, 7, 7, 7 >>> 19 >>> 27 19%17=2 , 19%19=0 >>> 68 >>> 26 >>> 72 >>> 0 (72%17=4, 72%19=15, 72%21=9, 72%23=3) >>> 75 >>> 26 >>> 78 >>> 0 (78%17=10, 78%19=2, 78%21=15, 78%23=9) >>> 107 >>> 26 >>> 120 >>> 26 >>> 127 >>> 26 >>> 185 >>> 26 >>> 201 >>> 26 >>> 259 >>> 26 >>> 264 >>> 1 >>> 294 >>> 26 >>> 311 >>> 26 >>> 323 >>> 26 >>> 349 >>> 26 The pins at position 7 and 19 are all effective. The pins at position 72 are all non-effective. Pins setting (for now): 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 17 [ ? ? + ? - ? ? + ? ? - ? ? ? ? ? ? ] 19 [ + ? - ? ? ? ? + ? ? ? ? ? ? ? - ? ? ? ] 21 [ ? ? ? ? ? ? ? + ? - ? ? ? ? ? - ? ? ? + ? ] 23 [ ? ? ? - ? ? ? + ? - ? ? ? ? ? ? ? ? ? + ? ? ? ] 25 [ + + + - + + - + - + + + - - - - - + + + + - - + + ] 26 [ - - + + - - - + + - + + - + - - + - - + - - - + - + ] Pins conbinations and corresponding key values ============================================== 00**** [1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10] (4) Then 110000 = 17 (27-10), il y a une roue (23/21/19/17) = 1 / 2 / ... 00***0 [2, 8, 9] 00***1 [5, 6, 8, 8, 9, 10] 00**0* [2, 2, 6, 8] 00**00 [2] (1) Lugs[ w23] or Lugs[ w21] = 2 ? 00**1* [4, 5, 9, 9, 9] 00**10 [5, 9] (10) Perhaps lugs[ w19 ] = 4 ? 00**11 [6, 10] 00*0** [4, 5, 6, 8, 9] 00*0*1 [9] 00*00* [5] (5) lugs [ w23] and/or lugs[w17] = 5 00*1** [2, 10] 00*1*0 [9] 00*1*1 [6] 00*10* [7] 000*** [5, 6, 6] 000**1 [3] 000000 [0, 0] 0001** [2] (8) Perhaps lugs[w21] = 2 ? 001*** [7, 8, 10] 001**0 [7, 9] 001*0* [5] (2) Perhaps lugs[w23] = 5 ? 001*01 [6] 01**** [9, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19] (6) lugs[w25] = 9 and lugs[w26] >= 7 01***0 [9, 14, 14, 14, 14, 16, 16, 16] 01***1 [12, 12, 14, 15, 15, 17, 18, 18, 19] 01**0* [9, 10, 12, 14, 16, 16, 17] 01**00 [16] 01**1* [13, 14, 15, 18, 18, 19, 19] 01**11 [14] 01*0** [10, 13, 13, 14] 01*0*0 [14, 14] 01*0*1 [14] 01*00* [10] 01*01* [13] 01*011 [14] 01*1** [11, 12, 15, 16, 16, 18, 18] 01*1*0 [16] 01*1*1 [19] 01*10* [12] 01*11* [14] 010*** [10, 13, 14] 010*1* [15] 010*10 [13] 0100** [14] 0101** [11] 011*** [16, 16, 16, 16, 18, 18, 18] 011**0 [17, 18] 011*0* [16] 011*1* [17] 0110** [15, 17] 0111** [19] 10**** [12, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 19, 19, 20, 20] (7) lugs[w26] = 12 (the smallest value) 10***0 [16, 17, 17, 17, 17] 10***1 [15, 17, 18, 20] 10**0* [16] 10**1* [19, 20] 10**10 [17] 10*0** [16] 10*01* [19] 10*1** [15, 18, 19, 19, 20] 10*1*0 [14] 10*10* [17] 10*11* [20] 100*** [12, 14, 17, 18] 100*01 [15] (9) From other deductions: lugs[w17]= 1 100*1* [17] 1000** [12] (3) Perhaps lugs[w26] = 12 ? 101*** [17, 18, 19, 19, 20] lugs[w25] >= 7 11**** [19, 19, 19, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26] 11***0 [19, 22, 24, 24, 24, 25] 11***1 [25, 25, 25, 25, 26] 11**0* [19, 19, 21, 21, 22, 23, 24, 24] 11**00 [19] 11**01 [22, 25] 11**1* [23, 25, 25, 26, 26, 26] 11*0** [19, 19, 20, 22, 25, 25, 25, 26] 11*0*1 [20] 11*1** [21, 22] 11*1*0 [26] lugs[w17] = 1 110*** [21, 21, 21, 23, 25] 110**0 [19] 110**1 [24] 110*01 [22] 110*1* [23] 1101** [24] 111*** [23, 24] 111111 [27, 27] First, we deduce lugs values: 12-9-5-2-4-1 Then we can deduce overlaps: 1-2 :2, 1-3 :2, 3-5 : 1, 4-5 :1 We try to complete Pins setting =============================== Pins conbination at position 53: Pos: w26 w25 w23 w21 w19 w17 : Key 021: - - ? ? - - : 2 => Pins[w21][21%21=0] = 1, ... Pins[w23][21%23=21] = 0 040: - - ? 2 - ? : 7 => Pins[w23][40%23=17] = 1, ... Pins[w17][40%17=6] = 0 053: - - 5 ? - 1 : 6 => Pins[w21][53%21=11] = 0 etc... Solution: ========= External Key: AAAAAA Lugs: (12-9-5-2-4-1; [12]*2,[13]*2,[35][45]) ------------------------------- NR LUGS 1 2 3 4 5 6 ------------------------------- 01: 1-2 A A A _ _ A 02: 1-2 _ _ _ B B _ 03: 1-3 C _ C _ _ C 04: 1-3 _ _ _ _ D _ 05: 3-5 _ _ _ _ E _ 06: 4-5 F _ F F F F 07: 1-0 _ G _ _ G _ 08: 1-0 _ H H H _ H 09: 1-0 I I I I _ _ 10: 1-0 _ J J J _ J 11: 1-0 _ _ _ K K _ 12: 1-0 _ _ _ _ L L 13: 1-0 M M M M _ M 14: 1-0 _ N _ N _ _ 15: 2-0 O O O O _ _ 16: 2-0 _ P _ _ _ _ 17: 2-0 _ Q _ Q Q _ 18: 2-0 R _ R R R 19: 2-0 S S S _ S 20: 2-0 _ T T T 21: 2-0 _ _ U U 22: 3-0 _ V _ 23: 3-0 W _ _ 24: 0-4 X Y 25: 0-5 _ Z 26: 0-5 Z 27: 0-6 ------------------------------- Shift: Z, 26 letters Check: NQVLP RHANN XWIPF EOPSA IBGUR X -------------------------------