Send and Receive Secret Messages

Introduction

Send and receive secret messages by encrypting and decrypting them. The program will use a simple shift cipher that was used by Julius Caesar.

For more information see Wikipedia Caesar Cipher.

How a Simple Shift Cipher Works

A simple shift cipher replaces every plaintext letter in the alphabet with a letter from the shifted alphabet.

For example, if the shift count is +3

ABCDEFGHIJKLMNOPQRSTUVWXYZ (plaintext alphabet)
XYZABCDEFGHIJKLMNOPQRSTUVW (shifted alphabet)
A becomes X, B becomes Y, C becomes Z, D becomes A, ...

Design Questions

What to do with punctuation characters, etc? (.,"'&*%$@?/[]{})
What to do with number characters? (1234567890)
What to do with spaces?
What to do with unprintable characters?
(For example, ASCII has a bell characters which would ring the bell on a teletype machine)

Note: the Enigma machine only encoded capitol A - Z
   - lowercase letters were not allowed
   - numbers were spelled out (one, two, ...)
   - unprintable characters were never transmitted
   - punctuation, spaces, etc. where replaces by an 'X'
   - This was good enough for text messages

Design

  1. All lowercase letters will be converted to uppercase for encryption (This simplifies the program)
  2. The program will ask the user for:
    • The shift count (positive integer)
    • Encode or decode a message
    • The message text (To start with, limit the message to 128 characters. You can add more later.)
  3. The program will display the resulting encoded or decoded message
  4. The program will loop until a "quit" command is entered

Links

Wikipedia - Caesar Cipher
Wikipedia - Cryptography
Wikipedia - ASCII
ASCII Codes (decimal)
Wikipedia - Enigma machine

Try This

  1. Add negative shift capability (instead of shifting right, shift left) (For example, shift can be 3, +3, -3)
  2. Add lowercase characters
  3. Encrypt or decrypt a text file
    • ask the user for the name of a text file to input
    • ask the user for the name of the file to be output
    Note: Encrypt and decrypt simple ASCII text files. You can create ASCII test files with Windows notepad, or other editors found on the web
  4. ASCII uses only 128 of the 256 values in a byte. Encode all 256 values