A playing card cryptosystem

Introduction

This page describes a cipher using playing cards which I have devised. It was indirectly inspired by various other such systems, like Solitaire, Mirdek, this system. Incidentally, I was responsible for finding the "serious weakness" mentioned in the page for the third of these systems.

Of course, this system may contain insecurities that I am not aware of. Furthermore, this is an autokey system (that is, one in which the system will get into different states depending on the letters in the plaintext), and consequently it does have high vulnerability to garbles.


Preliminaries

The Ace through King of clubs followed by the Ace through King of spades correspond to plaintext a through z. The Ace through King of diamonds followed by the Ace through King of hearts correspond to ciphertext A through Z.

The cards start out face up arranged in a sequence of (around 7) piles, according to a key. Some of the piles may be empty. The cards will remain face up and in the same number of piles throughout the process.

The encryption of one letter has two stages: finding the corresponding ciphertext letter, and rearranging the cards.


Finding a ciphertext letter

To find the ciphertext letter corresponding to a plaintext letter, consider all of the cards to be arranged in one cycle obtained by stacking all of the piles with the last pile on top. Then, if the red and black cards are considered to be opening and closing parentheses, respectively, the ciphertext letter is the card matching the plaintext letter. Equivalently, we can count backwards through the cards, starting with 1 on the plaintext card, adding 1 whenever we encounter a black card, and subtracting 1 when we encounter a black one; the card we want is then the first card on which we reach 0.

For instance, suppose the cards are laid out in the following way. The top of each pile is at the end of its line. Lowercase letters are black cards, uppercase ones are red cards.

[1] i l L Y n H R u m I k r
[2] J e V
[3] <empty>
[4] Q z C o E y s t x B f O X
[5] a K N
[6] w A c Z G P b
[7] j W U T v D M S q g F p h d

Then n encrypts to Y, a encrypts to X, m encrypts to H, d encrypts to U, and x encrypts to O. The next diagram is for x -> O; note that we wrap around the end of the deck between i and d.

O X a K N w A c Z G P b j W U T v D M S q g F p h d i l L Y n H R u m I k r J e V Q z C o E y s t x
( ( ) ( ( ) ( ) ( ( ( ) ) ( ( ( ) ( ( ( ) ) ( ) ) ) ) ) ( ( ) ( ( ) ) ( ) ) ( ) ( ( ) ( ) ( ) ) ) )
0 1 2 1 2 3 2 3 2 3 4 5 4 3 4 5 6 5 6 7 8 7 6 7 6 5 4 3 2 3 4 3 4 5 4 3 4 3 2 3 2 3 4 3 4 3 4 3 2 1


Rearranging cards

To rearrange the cards, we pick up the pile that has the plaintext letter, and deal its cards into the preceding piles one at a time, starting at the top of the pile, just like the sowing operation in Mancala-style games. That is, we place the top card in the preceding pile, the next card in the pile before that, the next card in the pile before that, and so forth, wrapping around when we reach the beginning of the row. The space which the pile came from should be filled along with the other piles.

For additional security, we can then repeat this sowing (k - 1) more times for some constant k, taking the pile that the last card landed on to distribute in the next sowing operation in each case. In the version described above k = 1, but k >= 3 is probably more reasonable.

So, if the cards are laid out as in the example above, and we had just encrypted a t (to K, incidentally), we would distribute the cards from the fourth pile, which t was in, and the piles would then look like this.

[1] i l L Y n H R u m I k r f o
[2] J e V O E
[3] X y
[4] s
[5] a K N t Q
[6] w A c Z G P b x z
[7] j W U T v D M S q g F p h d B C

We placed X on pile 3, then O on pile 2, then f on pile 1, then B on pile 7, and so forth.


Decryption

I will not describe decryption here at this time. The decryption algorithm can be inferred from the above encryption algorithm.


This page was last modified 20:58 2 November 2003.
Up