Search for a tool
Solitaire Cipher (Schneier)

Tool to decrypt / encrypt with Solitaire by Schneier. Solitaire is a cryptographic cipher using a deck of cards, invented by Bruce Schneier in the roman Cryptonomicon.

Results

Solitaire Cipher (Schneier) -

Tag(s) : Poly-Alphabetic Cipher

Share dCode and you

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!

Team dCode likes feedback and relevant comments; to get an answer give an email (not published). It is thanks to you that dCode has the best Solitaire Cipher (Schneier) tool. Thank you.

# Solitaire Cipher (Schneier)

## Solitaire Decoder (by B.Schneier)

 These codes represent the deck of cards in initial position (from 1 to 52 + A + B) the generated keystream (sequence of cards as numbers from 1 to 52)

## Solitaire Encoder (by B.Schneier)

 These codes represent the deck of cards in initial position (from 1 to 52 + A + B) the generated keystream (sequence of cards as numbers from 1 to 52)

## Letters conversion A=1,Z=26

Tool to decrypt / encrypt with Solitaire by Schneier. Solitaire is a cryptographic cipher using a deck of cards, invented by Bruce Schneier in the roman Cryptonomicon.

### How to encrypt using Solitaire cipher?

Bruce Schneier's Solitaire encryption is a poly-alphabetic cipher whose encryption key is generated with a deck of cards.

Example: Encrypt the message CRYPTONOMICON with the unmixed card game 1,2,3,4...,52,A,B

Step 1: Associate with each character of the message a number like A=1,B=2,...Z=26 (code A1Z26)

Example: C has the value 3, R becomes 18, Y becomes 25, etc.

Step 2: Generate a code (keystream) by mixing the card game according to the solitaire algorithm (see below)

Example: The first code obtained is 4 (then 49, then 10, etc.)

Step 3: Add two by two the numbers of steps 1 and 2. If the total obtained is greater than $26$, subtract $26$.

Example: $3 + 4 =$ 7, then $18 + 49 =$ 67, as $67 > 26$ calculate $67-26 = 41$ and again $41-26 = 15$ etc.

Step 4: Replace each number by the letter corresponding to it (inverse operation of step 1), 1=A,2=B,...26=Z. The letters obtained correspond to the encrypted message.

Example:

 Plain text C R Y P T O N O M I C O N Coded letters 3 18 25 16 20 15 14 15 13 9 3 15 14 Card Keystream 4 49 10 24 8 51 44 6 4 33 20 39 19 Calculation Step 3 7 15 9 14 2 14 6 21 17 16 23 2 7 Cipher text G O I N B N F U Q P W B G

### How to decrypt Solitaire cipher?

Decryption requires knowing the exact order of the deck of cards.

Decryption is the same as encryption, except for step 3 where you do not add but subtract from each number the one generated by the deck of cards. If the number is less than $1$, add $26$.

Example: Decrypt VQMLVBLTF with generated codes (dummies) 3,2,1,3,2,1,...:

 Cipher text V Q M L V B L T F Coded letters 22 17 13 12 22 2 12 20 6 Card keystream 3 2 1 3 2 1 3 2 1 Inverse Step 3 19 15 12 9 20 1 9 18 5 Plain text S O L I T A I R E

### How to code a card deck?

Bruce Schneier describes an unmixed card game with the following numbers:

(Clover) Ace,2,3,...,10,J,Q,K equal to 1,2,3, ... 10,11,12,13

(Diameter) Ace,2,3,...,10,J,Q,K being 14,15,16, ... 23,24,25,26

(Heart) Ace,2,3,...,10,J,Q,K being 27,28,29, ... 36,37,38,39

(Spades) Ace,2,3,...,10,J,Q,K being 40,41,42, ... 49,50,51,52

Joker A, Joker B worth respectively A or 53, B or 53 (also)

Clover > Diamond > Heart > Club is the order of the game used in the rules of the Bridge game

### How to generate codes by shuffling the cards? (Solitaire Algorithm)

The generation of codes is the most complicated part of the Solitaire code, it involves a precise mixture.

Example: 2,6,A,3,4,5,1,7,8,...,B,9 is a set of 54 cards (with separate wildcards A and B) in this modified starting position

Step 1: Move the joker A by 1 card below in the stack (which is to exchange the joker A with the card immediately below). If this is not possible, ie. if the joker A is at the bottom of the stack (so it does not have a card underneath), then move it on top of the stack and apply step 1 (so it will become the second card of the deck)

Example: 2,6,3,A,4,5,1,7,8...,B,9

Step 2: Move the B joker by 2 cards underneath into the stack. Again if it is not possible, if the joker B is at the bottom of the pile, then move to position 3 (it will have 2 cards above) or if the joker B is in at second last position, then move it to position 2 (1 card above it). This comes down to considering that the card game is a loop on itself.

Example: 2,B,6,3,A,4,5,1,7,8,...,9

Step 3: Make a triple cut at the level of the jokers (the jokers and all the cards between them do not move but the groups of cards before and after exchange, even if a group is empty)

Example: 1,7,8,...9,B,6,3,A,4,5,2

Step 4: Cut after the Nth card where N is the number corresponding to the card at the bottom of the stack, leaving this last card in its place. If the last card is a joker, do not change anything at this stage.

Example: 1,7,8,...9,B,6,3,A,4,5,2

Step 5: Note the number X of the card in the N+1 position where N is the number corresponding to the top card of the stack (which is in position 1). X is the generated code (the deck is not mixed at this stage).

Example: 1,7,8,...9,B,6,3,A,4,5,2 The first code is 7

Repeat steps 1-5 to obtain the following code of the keystream.

### How to recognize a Solitaire ciphertext?

A message encoded by Solitaire has a coincidence index close to random.

All references to card games, bridge, the Solitaire game, or Freecell or the Cryptonomicon book and its author Bruce Schneier are clues.

### What are the variants of the Solitaire cipher?

The card game could be encoded in numbers in any other way provided that the sender and receiver agree on the method.

The original position of the card game is better if it is perfectly random, but it is possible to generate one from a keyword. Bruce Schneier describes a keyword-based method for mixing the deck by encoding it as in step 1 of the encryption. Then, it recommends to practice a shuffle of the cards identical to the solitaire algorithm but by replacing the step 5 by a new step 4 where the cut is in position M with M a keyword letter code. Repeat all steps as well for each letter.

Optionally, the last 2 letters of the keyword (their codes $c1$ and $c2$) can be used to move the jokers respectively after the card in position $c1$ for the joker A and after the card in position $c2$ for the joker B.

### When Solitaire have been invented ?

Neal Stephenson describes the Solitaire algorithm in Cryptonomicon, a science fiction novel published in 1999. The algorithm was created by Bruce Schneier, cryptography consultant for this book.

## Source code

dCode retains ownership of the source code of the script Solitaire Cipher (Schneier) online. Except explicit open source licence (indicated Creative Commons / free), any algorithm, applet, snippet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in any informatic langauge (PHP, Java, C#, Python, Javascript, Matlab, etc.) which dCode owns rights will not be released for free. To download the online Solitaire Cipher (Schneier) script for offline use on PC, iPhone or Android, ask for price quote on contact page !