Crypt::Solitaire - Solitaire encryption


# OO Interface use Crypt::Solitaire; $ref = Crypt::Solitaire->new( $passphrase ); $encrypted = $ref->encrypt( $text );

  $ref2 = Crypt::Solitaire->new( $passphrase );
  $decrypted = $ref2->decrypt( $encrypted );

# Functional Interface

  use Crypt::Solitaire;
  my $encrypted = Pontifex( $plaintext, $passphrase, $mode );


Solitaire is a top-notch pencil-and-paper encryption system developed by Bruce Schneier. Here is the description in Schneier's own words:

"In Neal Stephenson's novel Cryptonomicon, the character Enoch Root describes a cryptosystem code-named "Pontifex" to another character named Randy Waterhouse, and later reveals that the steps of the algorithm are intended to be carried out using a deck of playing cards. These two characters go on to exchange several encrypted messages using this system. The system is called "Solitaire" (in the novel, "Pontifex" is a code name intended to temporarily conceal the fact that it employs a deck of cards) and I designed it to allow field agents to communicate securely without having to rely on electronics or having to carry incriminating tools. An agent might be in a situation where he just does not have access to a computer, or may be prosecuted if he has tools for secret communication. But a deck of cards...what harm is that?

"Solitaire gets its security from the inherent randomness in a shuffled deck of cards. By manipulating this deck, a communicant can create a string of "random" letters that he then combines with his message. Of course Solitaire can be simulated on a computer, but it is designed to be implemented by hand.

"Solitaire may be low-tech, but its security is intended to be high-tech. I designed Solitaire to be secure even against the most well-funded military adversaries with the biggest computers and the smartest cryptanalysts. Of course, there is no guarantee that someone won't find a clever attack against Solitaire, but the algorithm is certainly better than any other pencil-and-paper cipher I've ever seen."

Simple system, easy to use, and relatively fast.


Restricted only to letters A..Z. Lower case letters are converted to upper case, and due to the fact that Solitaire applies its own formatting to the text, the output can be a little tricky at first glance.

It also should be noted that there is a verified bias in the algorithm. Fore more information on this, go here:


Pontifex $text, $passphrase, $mode

$text is encrypted using $passphrase. Encrypts or decrypts, based on $mode. Mode must be set to "e" or "d," for encrypting and decrypting, respectively.


Designed by Bruce Schneier (President, Counterpane Systems)

Original Perl Code by Ian Goldberg <>, 19980817

Minor changes and module-ification by Kurt Kincaid <>


perl(1), Counterpane System (