The Half-Deck Cipher Cracked

Gary J. Shannon
Created Aug 3, 2010
Updated Aug 3, 2010

The Half Deck Weakness

Consider double ciphertext letters. Look at lazy and see how az is enciphered each time. Look at over and see how the ve pair is enciphered each time. Look at the ox in fox. Under what conditions is that pair enciphered as a double?

Knowing that the numeric key is five digits long, how do they align with the various pairs of doubles, expecially the ve pairs, and under what conditions do v and e encipher to the same letter?

Let's call the unknown digits of the key by their position: 1, 2, 3, 4, 5

      the quick brown fox jumped willy nilly over the lazy dog
      
      123 45123 45123 451 234512 34512 34512 3451 234 5123 451
      ONC JHNEK OKJGG WUI SRNWFX HDEXD EKSRK YYCJ FSQ VNND ELK
      
      234 51234 51234 512 345123 45123 45123 4512 345 1234 512
      SLB LCHEF QZYIF JNZ NAQJPW WACYA WHULH UFHV DXB NLLU MXI
      
      345 12345 12345 123 451234 51234 51234 5123 451 2345 123
      KCY ILNKB FYESA LEE PNZWSA UMQIS OVEDM DPPH IUZ PYYT SFO
      
      451 23451 23451 234 512345 12345 12345 1234 512 3451 234
      OUZ DFURK VXGQJ QHE LHTIGW KOAON XOVOA JGQB HAW GQQB CMZ
      
      512 34512 34512 345 123451 23451 23451 2345 123 4512 345
      HLX YMXKY NVYTL RWJ NNRBWN IWGWW WDODD NIIH VZK WFFV GEW
      
      123 45123 45123 451 234512 34512 34512 3451 234 5123 451
      WLS OMLUH WHOAA KZB PTLKEG MDUGD UHPTH NNSO EPV FLLD URH
      
      234 51234 51234 512 345123 45123 45123 4512 345 1234 512
      PRI RSMUE VCNBE OLC LQVOYK KQSNQ KMZRM ZEMF DGI LRRZ JGB
      
      345 12345 12345 123 451234 51234 51234 5123 451 2345 123
      HSN BRLHI ENUPQ RUU YLCKPQ ZJVBP WFUDJ DYYM BZC YNNX PEW
      
      451 23451 23451 234 512345 12345 12345 1234 512 3451 234
      WZC DEZTH FGAVO VMU RMXBAK HWQWL GWFWQ OAVI MQK AVVI SJC
      
      512 34512 34512 345 123451 23451 23451 2345 123 4512 345
      MRG NJGHN LFNXR TKO LLTIKL BKAKK KDWDD LBBM FCH KEEF AUK
    

The a-z relationship exists because when enciphering a, only one pile is ever used, and so the card that enciphers a always ends up at the bottom of the deck where it is next used to encipher z. Therefore a followed by z will always be a double ciphertext letter regardless of key digit value.

But for v-e to be a double letter, the card that enciphered v must end up five cards down from the top, ready to encipher e next time around. Because v is the 22nd letter, 22 cards will be dealt out into some number of piles that puts the 22nd card where it will become the fifth card from the top after the piles are collected. That means that since there are 4 cards left in the hand (26 - 22), then the card that enciphered v must be on top of the leftmost pile, since it will fall directly after the four cards in hand. That means that the number of piles under key digits 1 and 3 must be numbers that leave a remainder of one when divided into 22. The possibilities are: 3 and 7, since 3 * 7 + 1 = 22 and both 3 and 7 are prime. Therefore the key digits in positions 1 and 3 must both be either 3 or 7.

Now the ox of fox is enciphered as a double only when the o is under the second key digit. For the o card to end up in the 24th position ready to encipher x, after enciphering o (letter number 15) that means that considering the 11 cards left in hand after enciphering o, the o card, to end up 24th from the top after gathering the card, must be the 13th card picked up. Now the 15 cards that were dealt out had to be dealt into some number of piles that allowed 12 cards to be picked up before the o card was picked up. Into how many piles would you need to deal 15 cards so that the last card dealt had 12 cards in the piles to its left? A little trial and error shows that 3 piles leaves 10 cards to be picked up before the 15th card, so that won't work. 4 piles doesn't work either, but 5 piles does the trick. In fact, 5 piles is the only number of piles that can possisbly result in o followed by x being enciphered as a double, so know we know for sure that key digit 2 must be 5.

So we now have the known digits of the numeric key as -5---.

On line two we have the double WW for plaintext dw (the end of jumped and the start of willy). Since W is the 23rd letter, after enciphering d, the same card must end up 23 from the top of the deck. Since d is the 4th letter, there are 22 letters left in hand after enciphering d. This means that the card that enciphered d must end up on top of the first pile. For that to happen there must have been 3 pile when enciphering d. No other number of piles would put d on top of the leftmost pile. Since d was enciphered under the 3rd key digit, the third digit of the numeric key must be 3.

Now the known the digits of the numeric key are -53--

Now we need to find doubles that start at positions 1, 4, and 5 in the key. For position 1 we can't use the plaintext az in lazy (line 1) because any double starting with a, since a is the first letter, results in only one pile no matter what the key value. On line 3 the ve in over, as we found above, only narrows the pile number down to being either 3 or 7, so we need to keep searching. One the very last line we find ju enciphered as a double. What can we learn from that?

Because u is the 21st letter, after enciphering j we need to find the necesary card 21 down from the top of the deck. Enciphering j, the 10th letter, left 16 cards in hand, which means the necessary card must be the 5th card picked up (21 - 16), meaning there must be 4 cards in the piles to left of the necessary card. How many piles does it take to deal out 10 cards and have 4 cards in piles to the left of the last card dealt? By trial and error, only 7 piles will due. Of course from the ve in over we already knew it had to be either 3 or 7, but now we know for sure.

Now the known digits of the key are: 753--.

Next we need to find a double starting at key positions 4 and 5. The ly of willy in line 5 gives us a double at key position 5.

Since y is the 25th letter, the necessary card must end up 25 from the top ater enciphering l. Enciphering l dealt out 12 cards, leaving 14 cards in hand. Therefore the necessary card must be the 11th picked up. In other words, after dealing 12 cards, how many piles do we need to end up with 10 cards to the left of the last one dealt? By trial and error, only 6 piles works, so the 5th digit must be 6.

Now we have 753-6 with only the 4th digit remaining to be discovered. However, there are no usable doubles starting at key position 4, so we will have to approach that from a different direction.

Look at the words willy and nilly on those lines where the i falls under key position 3. Consider just the -illy part of both words:

    	23451
    	-illy
    	IWGWW
    	WDODD
    	BKAKK
    	KDWDD
  

Notice the pattern where the double that follows key position 4 is the same letter that comes before key position 4. What can we learn about key digit 4 from this pattern? After enciphering i with the W card with 3 piles, the W card is left as the 24th card from the top. Then after enciphering l with an unknown number of piles, that 24th card has moved to a position 12 cards from the top of the deck. However, dealing off 12 cards, as required to encipher l, will always leave the 24th card at the 12th position, regardless of the number of piles, so that doesn't help.

So lets look for another pair of matched letters on either side of key position 4.

On line one we find pt kbr under key positions 345 enciphered as KOK. Unfortunately, b is a useless plaintext letter since it only creates 2 piles regardless of the key digit. So we keep looking. On line two we find heq encipherd as LBL under key 342.

After h is enciphered under key 3, with 3 piles, the L card ends up at position 22 in the deck. For it to encipher q as L it must end up at position 17 in the deck. Unfortunately, again, pt e is no help since 22 - 17 = 5, the number of e regardless of number of piles.

On line three we have lyo enciphered as DMD. Enciphering l under key 3 leaves the target card at position 23. Since y is letter number 25, the 23rd card will be distributed into one of the piles, and must end up in position 15 in order to encipher the following o. Therefore, we need to find out how many piles are necessary to move the 23rd card to position 15 after dealing out 25 cards into that number of piles. By trial and error, only four piles works, and so the final unkbown digit is revealed and the numeric key is 75346.

Now that the numeric key is known, and plaintext is available, it is a simple matter to backtrack the necessry locations of of each letter card. For example, the O card, the red 2, had to be the 20th card from the top at the start of the encipherment in order to be the cipher letter for t. After the first shuffle, the letter h was enciphered as N, which means it had to be the 8th letter after the first shuffle. But we can undo that first shuffle by performing the operation in reverse, and discover that the N card must have been at position 8 to start with, since the 7-pile shuffle with plaintext t would return the card at position 8 back to position 8 again. So now we know the positions of two of the cards in the original keyed alphabet.

By continuing this process of reversing each suffle the entire keyed alphabet is easily reconstructed and deciphering the unknown ciphertext becomes trivial.




< Back Home