My Stuff

A version of PGP for political prisoners?

It ain't PGP but it probably would work for political prisoners imprisoned in a third world communist government jail! Here is a cool animated web page that shows you how to do it. And at after the article on this page I give an example that shows how to use the code

Source

Two Centuries On, a Cryptologist Cracks a Presidential Code

By RACHEL EMMA SILVERMAN

For more than 200 years, buried deep within Thomas Jefferson's correspondence and papers, there lay a mysterious cipher -- a coded message that appears to have remained unsolved. Until now.

The cryptic message was sent to President Jefferson in December 1801 by his friend and frequent correspondent, Robert Patterson, a mathematics professor at the University of Pennsylvania. President Jefferson and Mr. Patterson were both officials at the American Philosophical Society -- a group that promoted scholarly research in the sciences and humanities -- and were enthusiasts of ciphers and other codes, regularly exchanging letters about them.

In this message, Mr. Patterson set out to show the president and primary author of the Declaration of Independence what he deemed to be a nearly flawless cipher. "The art of secret writing," or writing in cipher, has "engaged the attention both of the states-man & philosopher for many ages," Mr. Patterson wrote. But, he added, most ciphers fall "far short of perfection."

To Mr. Patterson's view, a perfect code had four properties: It should be adaptable to all languages; it should be simple to learn and memorize; it should be easy to write and to read; and most important of all, "it should be absolutely inscrutable to all unacquainted with the particular key or secret for decyphering. "

Mr. Patterson then included in the letter an example of a message in his cipher, one that would be so difficult to decode that it would "defy the united ingenuity of the whole human race," he wrote.

There is no evidence that Jefferson, or anyone else for that matter, ever solved the code. But Jefferson did believe the cipher was so inscrutable that he considered having the State Department use it, and passed it on to the ambassador to France, Robert Livingston.

The cipher finally met its match in Lawren Smithline, a 36-year-old mathematician. Dr. Smithline has a Ph.D. in mathematics and now works professionally with cryptology, or code-breaking, at the Center for Communications Research in Princeton, N.J., a division of the Institute for Defense Analyses.

A couple of years ago, Dr. Smithline's neighbor, who was working on a Jefferson project at Princeton University, told Dr. Smithline of Mr. Patterson's mysterious cipher.

Dr. Smithline, intrigued, decided to take a look. "A problem like this cipher can keep me up at night," he says. After unlocking its hidden message in 2007, Dr. Smithline articulated his puzzle-solving techniques in a recent paper in the magazine American Scientist and also in a profile in Harvard Magazine, his alma mater's alumni journal.

The 1801 letter from Robert Patterson to Thomas Jefferson The code, Mr. Patterson made clear in his letter, was not a simple substitution cipher. That's when you replace one letter of the alphabet with another. The problem with substitution ciphers is that they can be cracked by using what's termed frequency analysis, or studying the number of times that a particular letter occurs in a message. For instance, the letter "e" is the most common letter in English, so if a code is sufficiently long, whatever letter appears most often is likely a substitute for "e."

Because frequency analysis was already well known in the 19th century, cryptographers of the time turned to other techniques. One was called the nomenclator: a catalog of numbers, each standing for a word, syllable, phrase or letter. Mr. Jefferson's correspondence shows that he used several code books of nomenclators. An issue with these tools, according to Mr. Patterson's criteria, is that a nomenclator is too tough to memorize.

Jefferson even wrote about his own ingenious code, a model of which is at his home, Monticello, in Charlottesville, Va. Called the wheel cipher, the device consisted of cylindrical pieces, threaded onto an iron spindle, with letters inscribed on the edge of each wheel in a random order. Users could scramble and unscramble words simply by turning the wheels.

But Mr. Patterson had a few more tricks up his sleeve. He wrote the message text vertically, in columns from left to right, using no capital letters or spaces. The writing formed a grid, in this case of about 40 lines of some 60 letters each.

Then, Mr. Patterson broke the grid into sections of up to nine lines, numbering each line in the section from one to nine. In the next step, Mr. Patterson transcribed each numbered line to form a new grid, scrambling the order of the numbered lines within each section. Every section, however, repeated the same jumbled order of lines.

The trick to solving the puzzle, as Mr. Patterson explained in his letter, meant knowing the following: the number of lines in each section, the order in which those lines were transcribed and the number of random letters added to each line.

The key to the code consisted of a series of two-digit pairs. The first digit indicated the line number within a section, while the second was the number of letters added to the beginning of that row. For instance, if the key was 58, 71, 33, that meant that Mr. Patterson moved row five to the first line of a section and added eight random letters; then moved row seven to the second line and added one letter, and then moved row three to the third line and added three random letters. Mr. Patterson estimated that the potential combinations to solve the puzzle was "upwards of ninety millions of millions."

Undaunted, Dr. Smithline decided to tackle the cipher by analyzing the probability of digraphs, or pairs of letters. Certain pairs of letters, such as "dx," don't exist in English, while some letters almost always appear next to a certain other letter, such as "u" after "q".

To get a sense of language patterns of the era, Dr. Smithline studied the 80,000 letter-characters contained in Jefferson's State of the Union addresses, and counted the frequency of occurrences of "aa," "ab," "ac," through "zz."

Dr. Smithline then made a series of educated guesses, such as the number of rows per section, which two rows belong next to each other, and the number of random letters inserted into a line.

To help vet his guesses, he turned to a tool not available during the 19th century: a computer algorithm. He used what's called "dynamic programming, " which solves large problems by breaking puzzles down into smaller pieces and linking together the solutions.

The overall calculations necessary to solve the puzzle were fewer than 100,000, which Dr. Smithline says would be "tedious in the 19th century, but doable."

After about a week of working on the puzzle, the numerical key to Mr. Patterson's cipher emerged -- 13, 34, 57, 65, 22, 78, 49. Using that digital key, he was able to unfurl the cipher's text:

"In Congress, July Fourth, one thousand seven hundred and seventy six. A declaration by the Representatives of the United States of America in Congress assembled. When in the course of human events..."

That, of course, is the beginning -- with a few liberties taken -- to the Declaration of Independence, written at least in part by Jefferson himself. "Patterson played this little joke on Thomas Jefferson," says Dr. Smithline. "And nobody knew until now."

Write to Rachel Emma Silverman at rachel.silverman@wsj.com


Encrypting the data

This is the pgp program I used to generate this data

Take the message and write it vertically into columns that are grouped into 7 rows. For extra safety and security remove spaces

The message is

Mike is a homeless person who has smelly feet and likes to drink beer on Sundays when he isnt swimming in the Verde River near Catalina Island in Tucson like to go to the park and eat Indian food while smoking cigars.
Then gets converted into a table that looks like this:
1Motn soo
2I o Vl d
3Kh heat 
4Eadernhw
5 sr ddeh
6i iie  i
7ssns ipl
 
1 mknRnae
2ae i r 
3 lbvTks
4hleeu m
5oyetrcao
6m r  snk
7ef snodi
 
1leowen n
2eenia eg
3st mrla 
4s Sm itc
5 auiCk i
6pnnnaeIg
7eddgt na
 
1r a atdr
2slyilois
3oisni a.
4nk  ngn 
5 ewtao  
6wshh  f 
7h eeIto 
Next lets say the key is this string of 7 pairs of 2 digits
1,x 4,x 5,x 7,x 3,x 6,x 2,x
The first digit tells how we rearrange the rows in each set of 7 rows.
1,x says the first row stays the same

4,x says the 4th row becomes the 2nd row

5,x says the 5th row becomes the 3rd row

7,x says the 7th row becomes the 4th row

3,x says the 3rd row becomes the 5th row

6,x says the 6th row becomes stays the same

2,x says the 2nd row becomes the 7th row

And then we rearrange our rows like this
1Motn soo
4Eadernhw
5 sr ddeh
7ssns ipl
3Kh heat 
6i iie  i
2I o Vl d
 
1 mknRnae
4hleeu m
5oyetrcao
7ef snodi
3 lbvTks
6m r  snk
2ae i r 
 
1leowen n
4s Sm itc
5 auiCk i
7eddgt na
3st mrla 
6pnnnaeIg
2eenia eg
 
1r a atdr
4nk  ngn 
5 ewtao  
7h eeIto 
3oisni a.
6wshh  f 
2slyilois
The 2nd digit of each part of the key says how many garbage characters to place in front of each row.

Lets take the key we initially created and add a number as the 2nd digit of each pair.

The key was originally defined as:

1,x 4,x 5,x 7,x 3,x 6,x 2,x
Lets change the x to these values
1,6 4,3 5,0 7,1 3,8 6,3 2,4
This means we
1,6 Add 6 characters in front of the first row

4,3 Add 3 characters in front of the fourth row

5,0 Add 0 characters in front of the fifth row

7,1 Add 1 characters in front of the seventh row

3,8 Add 8 characters in front of the third row

6,9 Add 9characters in front of the sixth row

2,4 Add 4 characters in front of the second row

The data then looks like this with the garbage characters added to each row
1123456Motn soo
4321Eadernhw
5 sr ddeh
71ssns ipl
312345678Kh heat 
6123456789i iie  i
24321I o Vl d
 
1123456 mknRnae
4321hleeu m
5oyetrcao
71ef snodi
312345678 lbvTks
6123456789m r  snk
24321ae i r 
 
1123456leowen n
4321s Sm itc
5 auiCk i
71eddgt na
312345678st mrla 
6123456789pnnnaeIg
24321eenia eg
 
1123456r a atdr
4321nk  ngn 
5 ewtao  
71h eeIto 
312345678oisni a.
6123456789wshh  f 
24321slyilois
Last but not least you can add any number of garbage characters to the end of each line. The number of garbage characters is not in the key, nor does it need to be.

Here we add random garbage keys to the end of each line for the final encoded data.

1123456Motn soogarbageaddedtoendofline
4321Eadernhwgarbageaddedtoendofline
5 sr ddehgarbageaddedtoendofline
71ssns iplgarbageaddedtoendofline
312345678Kh heat garbageaddedtoendofline
6123456789i iie  igarbageaddedtoendofline
24321I o Vl dgarbageaddedtoendofline
 
1123456 mknRnaegarbageaddedtoendofline
4321hleeu mgarbageaddedtoendofline
5oyetrcaogarbageaddedtoendofline
71ef snodigarbageaddedtoendofline
312345678 lbvTksgarbageaddedtoendofline
6123456789m r  snkgarbageaddedtoendofline
24321ae i r garbageaddedtoendofline
 
1123456leowen ngarbageaddedtoendofline
4321s Sm itcgarbageaddedtoendofline
5 auiCk igarbageaddedtoendofline
71eddgt nagarbageaddedtoendofline
312345678st mrla garbageaddedtoendofline
6123456789pnnnaeIggarbageaddedtoendofline
24321eenia eggarbageaddedtoendofline
 
1123456r a atdrgarbageaddedtoendofline
4321nk  ngn garbageaddedtoendofline
5 ewtao  garbageaddedtoendofline
71h eeIto garbageaddedtoendofline
312345678oisni a.garbageaddedtoendofline
6123456789wshh  f garbageaddedtoendofline
24321slyiloisgarbageaddedtoendofline
 

Other Stuff