[image of digits]

Cryptology - Borland C++ Builder 6 Applications
The origins of the modern computer have their foundations in cryptography and cryptanalysis during the second world war.
Visit our other page on Cryptology for more information.
Cryptologic applications also provide us with experience in dealing with text.

Transposition Ciphers
scramble the letters in a message like an anagram...

The Turning Grille - "Apparatus for Cypher Correspondence" Patented #1163, 1875. Click on any image for an enlargement. (The letter "b" in the diagram simply represents a hinge.)

The circular holes are cut out of the card. The message is written, one letter per hole, until all the holes are filled. Then the card is turned clockwise ninety degrees and the message is continued. The card can be turned four times. (Note the Roman numerals in the lower right hand corner.)

Substitution Ciphers
replace one alphabet with another, one or more times in the message...

An Enigma Machine Simulator

This fantastic simulator was written by Dirk Rijmenants
and is available for free download from his Website:

http://users.telenet.be/d.rijmenants/en/enigmasim.htm

(I wish we could claim credit for it, but alas we had nothing
to do with it. The credit for superb work is all Dirk's.)

A Simple Cipher Slide Rule

Although this messages looks like cleartext, it is, in fact, a cipher:
Hope you are well this morning.
Two different informants provide you with two different keys:
ezbxg naffd czrdo gvqlv ymeyo.
gvwdf vlmqk rkdgs ugrtv qjtvi.

Which is the correct key?
What does this tell you about the security of the system?

Alphabetic One-Time-Key (Vernam Cipher)
An illustration of the one-time-key system of encrypting a message. Given a ciphertext and a key of at least the same length we can produce a ciphertext, and given a ciphertext and a key of the same length we can recover the cleartext. This system is absolutely unbreakable, provided that the key is absolutely random, used only once and kept secret. Texts may be entered in the white boxes using all lower-case letters and no spaces or punctuation. Texts will remain gray until they are Entered into the converter, whereupon they will turn black. When text in any two boxes is Entered text for the remaining box may be Extracted. The numeric values of the text characters (a=1 through z=26) are shown in the gray box at the right confirming that clear + key = cipher (modulo 26). An ASCII converter is included at the bottom. There is no reason why the entire ASCII character set may not be treated in this manner; however, for simplicity this application uses the old tradition of allowing for only lower-case letters.

Decipher this:
LTMSX VQPNO HUWDI ZYCGK RFBEJ
ZDZIA TAYHW AYBMU PIXTQ WBTKC

Note: ("to" -> "too")

U.S. Army Cipher Device M-94

A simulation of an actual field cipher device used for tactical messages prior to, and periodically during the Second World War. There are 25 different disks, numbered from 1 to 25 and given letter designations from B - Z. They can be placed on the spindle in any order. Each disk (rotor) contains the alphabet scrambled in a different sequence. You can change the order of the disks as well as rotate them into different positions. To encode a message, place the disks in a predetermined order and set the cleartext on any line. Then read any other line as the ciphertext. To decode, place the disks in the same predetermined order and set the ciphertext on any line. Then look for any other line that is intelligible.

AN EVOLUTIONARY DECRYPTION of a cyphertext might be found by modifying the Evolutionary Concert Tour application. The two systems are analogous: Finding the correct cleartext is a matter of finding the "fittest" (c.f. "shortest") arrangement of the 25 disks (c.f. "path through the 30 cities). The fitness of any disk order might be measured by the comparing the letter frequency of each line of text in that disk order to that of standard English. One might then choose the closest match as the fitness of that disk order. In this way we might be able to evolve a solution to the cyphertext.

An ASCII Code Chart

ASCII / Decimal / Byte Conversions

An illustration of how to pull individual bits out of an ASCII character and how to construct an ASCII character from individual bits. If we are to distribute ASCII code among pixels without changing their values by more than one, we will need to manipulate single low-order bits.

Only use bitmap (.bmp) images. There should be enough code in the applications on this page to complete this project.

A Hybrid Steganographic Image Vernan Cipher (unfinished)

This application is an extension of the one-time-key (Vernan Cipher) which accepts any printable character (view a Modified ASCII Code Chart), unlike the previous example which only accepts lower-case letters. It provides MemoBoxes for Clear, Key and Cipher texts as before. The idea is to use the low-order bits of pixels in an "innocent" Key Image downloaded from the Web (maybe something from CNN). To encript and hide a message, the user would first import what will become a Cipher Image which she wil post inconspicously on the Web (maybe as an eBay auction item). She will then unembed the the pattern in the Key Image to produce the Key Text. Next type and ENTER the Clear Text, which along with the Key Text will enable her to EXTRACT the Cipher Text. Finally she will embed the Cipher Text in the Cipher Image and then post it on the Web. Of course, the sender and receiver of the message must both agree on where to find the two images. Given the vast number of images on the Web, it will be inordinately difficult to discover which two images are being used, since neither one contains any tell-tale regularities.

A Clear Image is included to demonstrate the embedding of Clear Test in an image without encipherment. This, of course, is a much less secure alternative

Hiding Text in Images

Since the bitmap (.bmp) is the simplest uncompressed image file format, it should also be the simplest image format to to hide text in, making our programming efforts a little easier. Some drawbacks are that the file sizes are enormous and that bitmaps are not universally supported by Web browsers and Operating Systems. All works well with Windows and Internet Explorer, Macintosh and Firefox, as well as Linux and both Firefox and Konqueror.

Clearly, the first step documented below is hardly hidden, but it does demonstrate a pixel interpretation of ASCII text. Not surprisingly, since ASCII characters range from 0-127, and the red, green and blue primaries range from 0-255, the colors of the ASCII characters are dark. So any image containing such a randomly dark texture is a dead give-away that there is text inside.

We note that there is one piece of software offered for sale on the Web that hides text in images using a password. However, the image files grow by the size of the text and password added. Again, any image file that is substantially larger than it should be should be a dead give-away that there is text hidden inside.

A Tribute to Herbert O. Yardley
borrowed from the superb
National Cryptologic Museum.

This exhibit details the checkered career of Herbert O. Yardley (1889-1958), who headed the highly secret MI-8, or the "Black Chamber." Yardley began his career as a code clerk with the U.S. State Department, and during that service discovered his natural talent as a cryptanalyst. During World War I, Yardley served in the cryptologic section of Military Intelligence (MI) with the American Expeditionary Forces. After the war, Yardley lead the first peacetime cryptanalytic organization in the United States, MI-8. Funded by the Army and the State Department, MI-8, was disguised as a New York City company that made commercial codes for businesses. However, their actual mission was to break the diplomatic codes of different nations. A mission they were initially quite successful at completing, breaking codes from several foreign countries. MI-8 had an early success: in 1921-22, Yardley and his staff solved the cipher system used by Japanese negotiators at the Washington Naval Conference. They fed the decrypts to the U.S. chief negotiator, Charles Evans Hughes. The messages contained the Japanese’s minimum demands at the conference. Hughes appeared to be outsmarting the Japanese to obtain a more favorable agreement on naval capital ships, when actually he was reading their negotiating position every day before he went into the bargaining sessions. In 1929, the State Department closed down MI-8. According to legend, Secretary of State Henry Stimson at that time spoke the famous sentence: “Gentlemen do not read each other’s mail.” Disappointed, unemployed, and accustomed to luxury, Yardley found himself in need of finances and in possession of his country’s secrets. He wrote The American Black Chamber, which revealed to the world the work of MI-8. It became an international best seller. Needless to say, the Army, which continued codebreaking, was not amused. And the Japanese, for their part, changed their code systems. Surprisingly, at the time, the wording of the espionage laws contained a loophole that prevented the government from prosecuting Yardley. Yardley, a brilliant cryptanalyst, as well as a promoter of the cryptologic cause, continued to provide expertise to various countries, but never again worked for the United States.

Herbert O. Yardley

A .jpg image.
Size is 21,044 bytes.

Herbert O. Yardley

A .bmp image.
Size is 91,256 bytes.

Herbert O. Yardley

A .bmp image with the text at left inserted at the bottom of the .bmp file using SynEdit. The text appears at the top of the image as a somewhat random texture.
Size is 91,256 bytes.

An enlargement of the top of the image of Yardley showing the inserted text rendered as red, green and blue color triplets (pixels).

A portion of the bitmap (.bmp) image file with text inserted as seen in the binary/hexadecimal SynEdit editor.

The division between true pixel triplets and ASCII text is delineated in red.