Cipher Machines

Menu


Search






    World Wide Web
    CipherMachines.com

Types of Ciphers


"I well believe thou wilt not utter
   what thou dost not know;
   And, so far, will I trust thee."
- Shakespeare          

The history of cipher technology is an evolutionary tale of increasingly complex and elegant designs being made extinct by ingenious cryptanalysis and espionage. New and improved cipher machines were continually developed to fill the niches in the world of secret communications, encompassing written documents, teletype, voice, telemetry, images or moving pictures. Originally the use of ciphers was mainly the province of kings and armies but is now a pervasive fabric in modern society.

The battle of wits in cipher technology is a battle for survival of the cryptologically fittest, as has been demonstrated throughout history. Designing an unbreakable cipher was not necessarily the objective, since ease of use and speed of decipherment were the usual tradeoffs. Sometimes, just delaying the enemy from deciphering a message for a few hours was all that was necessary, because ease of use in the heat of battle was all-important. Complex and slow decipherment would be acceptable, however, for diplomatic messages requiring absolute secrecy for many years. Also, as communications technology advanced to telegraphs, radios and computers, cryptologic technology was forced to keep up with those advances. This need to satisfy different uses and continual improvements caused a wide variety of ciphers to be devised.

Modern ciphers use the increasing speed of computers to make increasingly strong ciphers while also making it transparent to the user. Cipher key lengths have been increasing over the years to counter the increasing ability of computers to be used for code breaking by brute force. DES, an early standard adopted in 1977 was demonstrated to be broken by brute force in 22 hours by 1999. Modern ciphers have additional requirements beyond the historical need for keeping a message secret. The modern cipher must also handle any exchange of keys in real time, ensure the message is not altered and verify the sender of the message.

The categories of ciphers listed below are not meant to be an exhaustive list, just a convenient grouping of the major types of ciphers used throughout history.




Monoalphabetic Ciphers

A monoalphabetic cipher mixes up the characters of the alphabet and uses that same arrangement for the entire message. The simple case would be to advance each letter some number of spaces, for example moving 3 letters down the alphabet, changing the "A" to a "D", the "B" to an "E", the "C" to an "F", etc. This was the cipher used by Caesar and any such substitution cipher bears his name. There are only 25 possibilities to check, so this type of cipher is trivial to solve but probably successful for Caesar because his foes were not able to read Roman and were mostly illiterate.


Slice Rule Cipher
Slide rule cipher toy

Another type of monoalphabetic cipher is called atbash, which is used in the Bible. The Old Testament, in Jeremiah 25:26 and 51:41, uses the name "Sheshach" in place of "Babel". Also, in Jeremiah 51:1 the words "Leb Kamai" are used for "Kashdim". Atbash is an exchange of the first letter of the Hebrew alphabet for the last, the second for the second to last, etc. Since "aleph" is exchanged with "taw" and "beth" is exchanged with "shin", the cipher is called atbash.

One advantage of the Caesar or atbash cipher is the ability to use these ciphers without the need to send any key information or have the cipher written down and subject to capture by the enemy. While other monoalphabetic ciphers would normally require that cipher to be written down, they do offer a much stronger cipher. For example, there are only 25 Caesar cipher arrangements possible since each letter can be shifted by 1 to 25 characters. By comparison, for any monoalphabetic cipher, the first letter can be exchanged for any letter, the second letter can be exchanged with any of the remaining 25 letters, etc. So the number of possible monoalphabetic ciphers is 26 X 25 X 24 X ... X 2 X 1 = 26! = 4.03 X 1026. The number of arrangements available is called the key length and normally gives an indication of the strength of the cipher. In the case of the monoalphabetic cipher, the large key length is misleading, since a systematic solution to this cipher was discovered. This type of cipher, however, was successfully used for many hundreds of years before that discovery.


Ibn ad-Duraihim
Ibn ad-Duraihim

One solution for a monoalphabetic cipher involves guessing some words in the message and understanding the likely and unlikely combination of letters in the language expected in the message. Likely words in a message are called cribs which was first described by an Arab scholar named Al-Khalil (c. 725-790 AD). He deciphered a cryptogram from a Byzantine emperor by guessing the first words were "In the name of God". Even with that guess, it took him a month to decipher the message, but this was the first recorded example of codebreaking. The use of cribs is a tried and true method of cryptanalysis for many types of ciphers even up to modern times.

Ibn ad-Duraihim (1312-1361) discovered a more systematic solution to the monoalphabetic cipher. His method to solve these types of ciphers is called letter frequency analysis, which means that for a specific language there is normally a frequency of each letter occurring which can be compared to the frequency of each letter in a message. Scholars had already analyzed the frequency of word and letters in the Koran, so ad-Duraihim compared those frequencies to the ciphertext to decode the message. The most frequent letter in the English language is "E", for instance, and the cryptanalyst would substitute an "E" for the most frequent letter in the ciphered message.




Polyalphabetic Ciphers

Rather than keep the same cipher alphabet throughout a message, it was discovered that changing the cipher within a message would thwart the efforts of a cryptanalyst from using letter frequency analysis to break the code. This is because each letter is now substituted by several different letters within the message. This is a polyalphabetic cipher, and while this is a much stronger cipher, it does add more operational complexity to change the cipher several times within a message.


Vigenere Cipher Disk
Vigenère cipher disk

The polyalphabetic cipher was invented in 1467 along with a cipher disk to make it more user friendly. This disk is called a Vigenère cipher disk, even though it was invented by Leon Battista Alberti 56 years before Blaise de Vigenère was born. It is made up of two disks with the normal alphabet around the circumference of one and a mixed up alphabet around the smaller disk. They rotate on a center pin so a different cipher alphabet can be used each time the disk is rotated. The inventor suggested changing the cipher every 3rd or 4th word by writing a capital letter in the cipher text. Other ways to use the disk is to have the sender and receiver of a cipher message agree on a starting position (for example, align the "A" to the "G") then decipher the first letter of the message. Use that deciphered letter to rotate to the "A" and decipher the next letter, and so on. These methods don't require any special key, other than the starting letter. Using letters within a message to change the cipher is called autokey.

Another way to use the cipher disk is to have an agreed on keyword or phrase, such as the Confederate Army keywords of "Complete Victory" or "Manchester Bluffs". Repeating keywords can be detected and aids in code breaking, so another strategy was to use different pages of a book, such as the Bible as the keywords. This means the keyword can be as long as the message itself, which complicates any cryptanalysis. Using normal text as a keyword is an aid to the cryptanalysis, however, since the keyword can be decrypted in parallel with the plaintext message.

One way to break the code of a polyalphabetic cipher is find several messages using the same keyword. Then each letter position of the message will have the same substitution letters and letter frequency analysis can be used on each letter position of the various messages. In addition, the keyword or phrase itself can contribute to the resolution of the cipher. The cryptanalyst uses the keyword and the ciphered text to guess at solutions to both, sometimes the keyword will be easier to decipher and then the cipher text is deciphered using that keyword.

The Vigenère cipher disk was used well into the 20th century and, in fact, was declared impossible to break by "Scientific American" magazine in 1917.

Jefferson Wheel Cypher
Jefferson Wheel Cypher, found in a home near Monticello


The Jefferson wheel cypher, first invented by founding father Thomas Jefferson around 1795, is another tool to make the polyalphabetic cipher more user friendly. In this cipher, there are many wheels with a mixed alphabet on the outside of the wheel. Each wheel is unique and the key is the order of the wheels on a central axle. This is a stronger cipher than the Vigenère disk since each wheel will have a different alphabet substitution instead of just one and there is no keyword to aid in code breaking. To encipher a message, the user would spell out the message on any line across all the wheels, then select any of the other 25 lines of mixed text as the coded message. To decipher, the receiver would stack the wheels in the agreed order and line up the wheels to spell out the coded message. Scanning across the other 25 lines of text, the one in readable text will stand out amongst the gibberish.

Wheatstone
Charles Wheatstone
(1802-1875)
Playfair
Lyon Playfair
(1818-1898)

Another example of a polyalphabetic cipher is the diagraphic cipher, which is the encipherment of a pair of letters in a message to another pair of letters. This type of cipher was used by the British military until WW2, called the Playfair cipher. It was invented by Charles Wheatstone, who named it after his friend Lord Playfair, who advocated its use. Ironically, Wheatstone has another cipher machine named after him, a type of Vigenère disk with extra numbers added, but it was invented 50 years earlier by Col. Decius Wadsworth in 1817.

A digraphic cipher enciphers pairs of letters into a different pair in such a way that a letter paired with two different letters in a message could result in no letter in common in the encipherment, thwarting letter frequency analysis. For example, "TH" and "TO" could be enciphered to "GX" and PM" so the relatively frequent letter "T" is hidden from letter frequency analysis. Letter frequency analysis can still be used on pairs of letters, but instead of 26 letters there are 600 pairs of letters (I/J are combined and repeating letters are not used, so the calculation is 25 X 24 = 600). This would be much more difficult to decrypt, especially for short messages.

The Playfair cipher uses a key word or phrase written in a matrix form, which is a convenient mnemonic so all 600 combination of deciphering pairs of letters does not have to be written down.

A description of how this cipher works is instructive, since it is relatively easy and requires only pencil and paper with an easily remembered keyword. Let's use the Confederate key phrase, "Manchester Bluffs". Arrange each unique character from the keyword into a 5 X 5 matrix and then fill out the remaining unused letters in order until the matrix is full (combining the I and J into one cell). Just by knowing the key phrase, you could quickly recreate the matrix below and then use this matrix to encipher the 600 pairs of letters for the cipher.

M A N C H
E S T R B
L U F D G
I/J K O P Q
V W X Y Z

Now to use this cipher, let's encode the name "Playfair". You start with the first pair of letters, "PL", and find them in the matrix. The row with the "P" has an "I/J" in the same column as the "L" and the row with the "L" has a "D" in the same column as the "P", so the "PL" is enciphered to "JD". Similarly, the "AY" becomes "CW", the "FA" becomes "UN" and the "IR" becomes "PE". In this way "Playfair" is enciphered to "Jdcwunpe". If the letter pair is on the same row, you select the letter to the right of each letter. Similarly, if they are in the same column, then select the letter below each letter. If you are already at the last row or column position, you wrap to the first letter of that row or column. For example, "SW" would be encoded as "UA". Of course, deciphering is the reverse.

The Playfair cipher could be used with different key phrases for each user and the phrase could change daily. This is a relatively strong pencil and paper cipher. The solution to this cipher was published in the first US government document on cryptology by Lieutenant Joseph O. Mauborgne, in 1914. Mauborgne went on to become a Major General and Chief Signal Officer with several major accomplishments to his credit. He was the first person to demonstrate the use of a radio in an airplane; he reinvented the Jefferson wheel cypher into a 25 wheel cipher, the M-94; he designed the one-time pad and proved it is the only theoretically unbreakable cipher and he was the Chief Signal Officer when the Japanese Purple cipher was broken just prior to WW2.

At the end of WWI, a proliferation of rotor based cipher machines were independently invented by four men in four different countries within the space of a few years. These are all polyalphabetic ciphers with each rotor wired to have a different substitution alphabet. Several rotors were placed in series to give a complex algorithm where each letter of a message is substituted several times. This type of machine provided a much stronger cipher but also simplified the operations for the users, both ciphering and deciphering was accomplished in similar fashion to using a typewriter. These rotor based machines saw extensive use in WW2, including the Nazi Enigma machine, the Japanese Purple machine, the US M-209 from Hagelin, etc. Almost all were broken by the enemy.


First rotor cipher machines 1917-1919
Hebern Scherbius Koch Damm
Inventors: Edward Hebern (USA), Arthur Scherbius (Germany), Hugo Koch (Netherlands), Arvid Damm (Sweden)

Edward Hebern
Edward Hebern

The first rotor cipher machine was invented in the US by Edward Hebern, a building contractor who was in jail in 1908 for stealing a horse. Apparently, he had time to think about cryptography and between 1912 to 1915 patented several cipher devices, including a check writing device, a cipher keyboard and two electric typewriters connected with 26 wires for automatic monoalphabetic ciphering. Hebern built his first rotor cipher in 1917. This first cipher machine had only one rotor which could be taken out and reversed to use in decipher mode. Hebern improved his cipher and used multiple rotors by 1921, when he filed for a patent and incorporated the Hebern Electric Code Company, selling $1 million in shares. He had high aspirations for his invention and built an extravagant factory for $386,000 to house 1,500 employees. He even wrote an ode to his cipher machine:


    Ode to the Hebern Cipher Machine
Marvelous invention comes out of the West
Triumph of patience, long years without rest
Solved problem of ages, deeper than thought
A code of perfection a wonder, is wrought

Of international scope, is the code electric
With merit so obvious, no nation can reject it
Result of deep study, when necessity goads
Hebern Electric, is the peer of all codes

Sphinx of the wireless, guardian of treasure
Brain of a nation, safety beyond measure
Heart of a battleship, preserver of lives
When brute force, against intellect strives

Keeper of secrets, of state and alliance
Inscrutable, wonderful, a mystery to science
Of depth so profound, brainy traitors, beware
Invisible around you, is the genii's snare

Conceived of the world war, in desperate need
Brains of all nations, competing in speed
Trained minds of the highest, seeking for might
An American achievement, is now brought to light
Monument to the Hebern Cipher Machine
Hebern Building
Hebern Electric Code building - Oakland, California

Hebern didn't realize that his cipher machine was secretly blackballed by William Friedman, the US cryptanalyst who would go on to solve the Japanese Purple cipher. Friedman pointed out a major shortcoming of the Hebern design or the design of any rotor cipher with odometer style stepping, including the Enigma. With this design, only one rotor spins and the other rotors are fixed for 26 characters of a message, making it vulnerable to cryptanalysis. Friedman went on to invent the SIGABA cipher machine, with its irregular stepping, which was one of the very few ciphers not broken by the enemy in WW2. Hebern went on to sell only a dozen machines before going bankrupt, ending up in jail again for defrauding his investors.


Arthur Scherbius
Arthur Scherbius

A German engineer, Arthur Scherbius, was the second inventor of a rotor cipher, which he called the Enigma machine (enigma has the same spelling and meaning in both German and English). He applied for a patent for his electro-mechanical cipher machine on February 23, 1918. He tried to sell his machine to the German military and commercial companies, but found little interest. In 1926, Scherbius developed his Enigma model C, reducing the weight from 110 down to 26 lbs. The German Navy bought this Enigma in February of 1926, followed by the German Army in June 15, 1928. The German military added a plugboard in 1930 to increase the strength of the cipher. Scherbius died in an accident with his horse drawn carriage on May 13, 1929 without knowing the consequential role his invention would play in world history.

The third rotor cipher inventor was Hugo Alexander Koch, who patented his invention on October 7, 1919 in the Netherlands. He never sold any cipher machines but instead sold the rights of his machine to Arthur Scherbius in 1927 for 600 Dutch guilders. Koch died the following year, on March 3, 1928. Some thought Scherbius bought the Koch patents to protect his own invention, but it seemed to be a curious purchase since the Enigma was patented first and the technology was equivalent. The rest of this story came to light only recently, as explained below.


Arvid Damm
Arvid Gerhard
Damm

The last rotor based cipher invented in this time was by Arvid Gerhard Damm in Sweden. He filed his patent 3 days after Koch on October 10, 1919. He used a double rotor with the innovation of irregular stepping, but his machines performed erratically so he never sold more than a few test units. Two investors were K.W. Hagelin and Emanuel Nobel (nephew of Alfred). Hagelin had his son, Boris, join the firm in 1922 in order to protect his investment. The Swedish army made a large purchase in 1926 and Damm died early the following year.

Boris Hagelin bought the firm and ran it, successfully developing cipher machines with printing capability (B-211) and a handheld device (C-35). It was a later Hagelin design, the C-38 cipher, which was modified by the US and made under license from Hagelin as the M-209. Over 140,000 were manufactured during WW2, making Hagelin the first and possibly only millionaire from cipher technology.

In 2003, it was discovered that the rotor cipher machine was actually invented prior to the four inventions mentioned above. In 1915, two Dutch naval officers, Theo A. van Hengel and R.P.C. Spengler came up with the idea while working in the Dutch East Indies. They built a prototype in the summer of 1915 but the Dutch navy decided not to adopt the cipher. Hengel and Spengler tried to patent the device but were stopped by the Dutch navy.

One of the patent attorneys working on the application was Huybrecht Verhagen, brother-in-law of Hugo Koch! This was likely how Koch developed his rotor cipher patent. To add to the intrigue, Koch was already working closely with Scherbius, who made his patent application first. This gives additional insight into why Scherbius may have bought the patent rights from Koch in 1927.

The only theoretically unbreakable cipher is the one-time pad, which is a type of polyalphabetic cipher. The key for a one-time pad is a random series of letters which is applied to the message, changing each letter of a message based on the random key. The reason this is unbreakable is that any letter in a ciphered message could be substituted for any plaintext letter and the random key doesn't give away any hints for the underlying message. A ciphered message of 55 characters, for example, can be deciphered into literally any 55 character message possible. The main drawback is the burden of transporting one-time pads.




Transpositions and Grills

The beginnings of cryptography can be dated to the use of transpositions of hieroglyphs in the tomb of Khnumhotep II in 1900 BC. The transpositions weren't necessarily made to keep the text secret, but to add dignity to the words and make it a form of riddle to keep the text interesting.

A transposition is simply moving the letters around in a prescribed fashion so the resulting cipher text is mixed up and unintelligible. A grill is usually a thin paper or metal sheet with a grid where some of the letter positions or syllables or words are cut out. The grill is a type of cipher machine used to make the transposition cipher easier to use.


Cardano
Girolamo Cardano
(1501-1576)

To create a message using a simple grill, the user would place the grill on a blank piece of paper and write the intended plaintext message in the holes of the grill. Then, remove the grill and fill in letters on the paper to hide the plaintext. If care is taken to make the language of this larger message as natural as possible, the enciphered message is even stronger because anyone intercepting the message would not suspect it is a ciphered message. This is an example of a combination of a transposition and a steganographic cipher. This type of grill was invented by Girolamo Cardano in 1550 and is called the Cardan grill.

If the grill is a square or rectangle, then the grill can be rotated or flipped so the four sides of the front and four sides on the back can each be used as a different cipher. Also, the ciphered text could be arranged in columnar or some other mixed up arrangement, adding complexity to the cipher.

Another type of grill is a rotating grill. For instance, a grill can be constructed with 8 rows and 8 columns, with 16 of the 64 spaces cut out in such a way as to have each the 64 letter positions displayed on only one of the 4 rotations. Any message would be arranged in a 8 X 8 matrix and the grill placed over the matrix to reveal the first 16 characters. The grill would then be rotated 90 degrees (clockwise or counterclockwise) to reveal another 16 characters, and so on until all 64 characters are arranged in the right order. This is usually added to some other type of cipher to increase the strength of the encryption. In this example, the grill acts as the cipher machine for a transposition cipher.

In general, transposition ciphers by themselves are not very strong, so they are normally used in conjunction with other ciphers. For instance, a message could be enciphered with a polyalphabetic cipher and to make it harder to break, a transposition could be added. Of course, this also adds work for the users to encrypt and decrypt the message.




Steganography

Steganography is a Greek word meaning concealed writing. This is a type of cipher or security based on obscurity. The secret message could be hidden inside a plain text message or image such that only the sender and receiver are aware of the secret communication. Other types of steganography includes invisible ink, microdots, messages under a postage stamp or wax seal, morse code knitted into a sweater, etc. The advantage of steganography over a cipher is that there is no indication that a message has been exchanged, protecting the communicating parties. This would be especially important for spies, where the exchange of a ciphered message, even if unbreakable, would expose the spy.

Chinese writing is not conducive to cryptography, but they did make use of steganography. They would write a message on silk ribbon and ball it up, cover it in wax and have a courier swallow it or insert it in his rectum. The Indians list secret writing as one of the 64 arts or yogas that women should practice. The Indian book, "Arthasastra", written in 321-300 BC recommends using secret writings by ambassadors. The first printed book on cryptography was written by Johannes Trithemius in 1499, called "Steganographia".

Steganography in the modern world is the hiding of a message in such as way as to avoid the appearance of an exchange of a message. This makes use of the random "noise" inherent in computer files and communications. For instance, changing some of the 256 color bits in each pixel of a picture can send a message and the difference in the picture would be undetectable. Messages can also be sent within fields in network protocols, in timing of packet transfers, font size and types, etc. These messages are usually enciphered first, so it resembles random noise, then sent via some steganographic means.




Codes

Codes have been used for centuries and were the preferred method of secret communications well into the 20th century. The difference between a cipher and a code is a cipher substitutes on a character-by-character basis to hide the message while a code reduces a word or phrase into a shorter group of numbers or letters. Usually, the code is a 4 or 5 digit number and the sender and receiver must have a code book with thousands or up to tens of thousands of codes. In the age of telegraph messages, codes were also used to reduce the length of messages, with significant cost savings.
Code Book
Example from an 1888 code book

Early code books would list the codes in numerical sequence and the words or phrases were also listed alphabetically. This allowed for a single code book to be used to encipher or decipher a message. But this was a serious design flaw which gave the cryptanalyst clues in decoding the message by using the relative position of known words from other decoded messages.

Later code books would list the codes in numerical sequence but the words and phrases were not in alphabetic order. This required a second book to list the words or phrases alphabetically. The first book was used to decipher a message and the second book would be used to encipher a message.

The use of codes was often combined with other ciphers, such as a transposition cipher, Vigenère cipher or some other cipher device. The first Vigenère disks included the numbers 1-4 so that numeric codes could be used directly (this limited the codes to combinations of these 4 digits). Alternatively, the letters could be used to represent the digits from 1-26.

Over the years, codes became more and more complex to counter the increasing sophistication of the codebreakers. Some codes were used as dummy text with no meaning and often used words could have several codes to choose from. A code can provide a strong cipher, but if a code book is lost or stolen, then decipherment of all communications is trivial until a new code book is created. Also, years of messages that remained secret can then be decrypted, yielding valuable intelligence even though the information is dated. Rewriting an entire code book and sending that book to all users can be a very cumbersome and risky process.

After the invention of the telegraph, codes were used in order to reduce transmission costs. Telegraph companies charged based on the number of words in a message, so 5 letter codes were used to replaced phrases or sentences, greatly reducing the cost of sending a message.

The added benefit of using codes was that the message was not immediately obvious to the code clerks who sent and received these messages. Since the telegraph code books were published and available, they were not secure but most messages were business correspondence and of little value, except possibly for business competitors.

Some telegraph code books were also designed to provide a true cipher code, as in the example above. The normal English word was used as the cipher, which has a 4 digit number and a sentence associated with it. Each word in the message could have an agreed to number added or subtracted, yielding a new or enciphered sentence in the book. So the key becomes the book, which is public, but also a private key of numbers to be added or subtracted. For even more security, the words of the message could be transposed.




Voice Scramblers

The difference between voice scramblers and voice encipherment is the scrambler works with the analog signal to transform that signal in some way so it is unintelligible to the eavesdropper. Voice encipherment means converting the analog voice signal to digital, then applying a cipher algorithm to that digital signal.

The early voice scramblers were invented before WW2 and used synchronized recordings to add noise to a voice signal, then the decoder would subtract that same noise. Another option was to invert the frequency, changing that frequency inversion over time. These methods of voice scrambling were not very secure and it was an inexact science. With practice an expert listener learned to decipher the conversation or the signal was studied and manipulated to reverse the scrambling.

The most advanced voice scramblers available in WW2 were used for conversations between Winston Churchill and Franklin D. Roosevelt, which the Germans were able to quickly decipher.

Use of radios and trench phones were notoriously insecure for voice messages, so they were often used for enciphered communications using morse code. A notable exception is the US using Navajo Indians in WW2, who spoke in their native language and were never deciphered by the Japanese. By the early 1960's voice encipherment used digital technology, providing a high level of encryption.




Modern Ciphers

Modern ciphers use the power of computing to provide message secrecy, message integrity (the message has not been changed) and sender authentication (the sender is who he claims to be). This is all provided without the need to exchange secret keys or have specialized cipher machines.

The basis for modern ciphers is the one-way mathematical function of factoring large prime numbers. The idea is that multiplying two large prime numbers is simple with computers, but finding the prime factors of a very large number is not practical. There is no known algorithm for finding such factors, so the only method now available is brute force. As an example, using a 128 bit key, there are 3.8 X 10**36 prime numbers that can be represented. If you could check one trillion of these numbers per second on a computer, and use 10 million computers in parallel, it would take the current age of the universe to check that many prime numbers.

For those interested in how public key encryption works, the following will be a simplified example. Let's say Alice wants to send a message to Bob. Bob has two large prime numbers multiplied together, but we will use small primes for illustration, p=5 and q=7. So the product, N= 5 X 7 = 35. Bob also calculates a number e which is relatively prime to (p-1)(q-1) or e is relatively prime to 4 X 6 = 24. Let's pick e=7. He also calculates d, where e X d = 1 (mod (p-1)(q-1)). In this case d=7, since 7 X 7 = 49 (mod 24) = 1.

Bob's public key is (N,e) or (35,7), his private key is (N,d).

Now the message Alice wants to send is also simple for illustration, it is the letter "M", which can be translated to the 13th letter of the alphabet, or "13".

The cipher message Alice sends is C = P**e (mod N), the plaintext is calculated as P = C**d (mod N).

C = P**e (mod N) using the public key of N=35 and e=7, Alice calculates: C = 13**7 (mod 35) = 62,748,517 (mod 35) = 27

Alice sends Bob the message "27"

Now Bob must decipher the message from Alice.

P = C**d (mod N) = 27**7 (mod 35) = 10,460,353,203 (mod 35) = 13 = M

Of course, the real calculations would be with extremely large numbers and would be accomplished without Bob or Alice aware of the calculations going on inside their computers.

As computer speeds increase, the key can also be increased. The only way to break this cipher is to find some way to mathematically factor a large number or to have massively parallel computing, for example with quantum or DNA computers. So for now the coders have the advantage.