hw2fa09 - CS1132 Fall 2009 Assignment 2 Adhere to the Code...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS1132 Fall 2009 Assignment 2 Adhere to the Code of Academic Integrity. You may discuss background issues and general solution strategies with others and seek help from course staff, but the homework you submit must be the work of just you. When submitting your assignment, be careful to follow the instructions summarized in Section 4 of this document. 1 Encryption Maintaining the confidentiality of digital data requires keeping unauthorized people from accessing that data and making the data unusable even if they are stolen. Encryption is the primary way to render information unusable to unauthorized parties. Encrypted text is plain text scrambled in some fashion-according to a key . The authorized user of the information will need to know this key to decode or decrypt the encrypted information. In this exercise, we will deal with a simple method of maintaining confidentiality through cryptography, the science of protecting sensitive data. You will learn about simple substitution ciphers, how to use them, and how to break them. 1.1 Creating a Substitution Cipher Key Simple substitution ciphers are a method of encryption in which individual letters of unencrypted text are replaced with individual letters of encrypted text. Each letter of the unencrypted alphabet is replaced with a unique letter in the encrypted alphabet. As an example, consider the following 5-letter alphabet: abcde : unencrypted alphabet or plaintext alphabet debca : encrypted alphabet or ciphertext alphabet In this case, the word bead in plaintext would be replaced with eadc in ciphertext. Your first task is to write a function genKey to return a substitution cipher key for the the full 26-letter alphabet. The substitution cipher key is a cell array of size 26. Each entry is a size 3 string: the first and third character in each cell are the character in plaintext and its corresponding character in ciphertext. The middle (second) character in the string is the space character ( ). For the example above, the key would look like this: K= { a d, b e, c b, d c, e a } One way to scramble the alphabet is to use the Fisher-Yates shuttle algorithm. Here is a description of how it works in this case: 1. we start with the identity cipher (each letter mapped to itself). The first position in each string will remain unchanged, we will only operate on the third position: e.g., K= { a a, b b, c c, d d, e e } 2. Randomly select one of the elements of the cell array. Swap the 3rd characters between the strings stored in the random cell chosen and the first cell of the cell array. Suppose the 4th cell is randomly chosen, then you have the cell array shown below: K= { a d, b b, c c, d a, e e } We then say the first element of the alphabet is fixed. Should the first element of the cell array be randomly selected, the resulting array would look unchanged from the original state. This is fine -randomly selected, the resulting array would look unchanged from the original state....
View Full Document

This note was uploaded on 09/04/2011 for the course CS 1132 at Cornell University (Engineering School).

Page1 / 5

hw2fa09 - CS1132 Fall 2009 Assignment 2 Adhere to the Code...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online