CSE 114 - HW 3
http://www.cs.sunysb.edu/~cse114/hw/HW3.html[4/13/2010 5:18:20 PM]
CSE 114 - Spring 2010
Computer Science II
Note that this HW assignment has only one part, the Monoalphabetic Cipher. Work for this HW assignment
should be done using the Unix environment.
Random Monoalphabetic Cipher using Objects
An important function in the world of Computer Security is encryption. In the encryption process, an original
readable message, referred to as
, is converted into apparently random nonsense, referred to as
. The purpose of such an operation is to be able to send messages that include sensitive information
like passwords, credit card numbers, etc.
.., from one location to another without snoopers intercepting and
reading the contents.
The encryption process requires 2 components: an encryption algorithm and a key. There are many different
algorithms, and for each, a different key will produce different ciphertext. Once a message is transformed into
ciphertext, it can be transmitted to its destination. Upon receipt of a ciphertext message, that message can be
decrypted into its original plaintext message using a decryption algorithm and key. Some encryption/decryption
algorithm pairs will both use the same key, while other one-way algorithms will use two keys (typically called
public and private keys).
encrption technique is one of the simplest, and is one in which the letters of plaintext are replaced
by other letters or by numbers or symbols. The earliest known use of a substitution cipher was by Julius Caesar.
The Caesar cipher involves replacing each letter of the alphabet with the letter standing K places further down
the alphabet, where K would be the Key value. In such an algorithm, the key ultimately determines which letter
to substitute a given letter with. For example, the following plain/cipher text pairs would result from a key of 3:
MEET ME AFTER THE TOGA PARTY
cipher: PHHW PH DIWHU WKH WRJD SDUWB
Note that the alphabet is wrapped around, so that the letter following Z is A. We can define the transformation
by listing all possibilities, as follows:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
Since adding characters and numbers is not convenient, Caesar would assign a numeric value to each
character (no I don't mean 5 for V). In the above alphabet, A would be 0, B would be 1, etc.
.. until Z is 25. Then,