Navigation
Solitaire
Help
Bruce Schneier's Solitaire cipher (codenamed "Pontifex" in Neal Stephenson's Cryptonomicon) uses a pass-phrase to generate a key stream as long as the message. The algorithm is intended to be followed manually with a deck of cards, but has been implemented in several programming languages. This page uses my PHP implementation. To find out how to implement the algorithm yourself, a good first step is the Perl implementation by Ian Goldberg.
Format restrictions: Solitaire is a strictly alphabetical cipher. Encrypting a text makes it lose case, spaces, punctuation and any other characters that are not part of the Latin alphabet. The same limitations apply to the passphrase.
Key generation: Solitaire actually uses a permutation of 54 playing cards as the key. Such a permutation can also be (non-reversibly) generated from a passphrase. To use a deck of cards directly, choose the appropriate option and enter the key in the following notation:
- 54 cards, separated by spaces, in order.
- Each card is either a joker (
A
orB
) or (without spaces) a rank and a suit. - The rank is one of
A, T, J, Q, K
(for Ace, Ten, Jack, Queen, King) or a digit from2
to9
. - The suit is one of
c, d, h, s
or (Unicode)♣, ♦, ♥, ♠
for Clubs, Diamonds, Hearts, Spades, respectively. - Example:
Ts Kd B 2s A ...
is "Ten of spades, King of diamonds, Joker B, Two of spades, Joker A ..."