ENGR/CS 101 CS Session Lecture 2 Starting with the next class, we - - PowerPoint PPT Presentation

engr cs 101 cs session lecture 2
SMART_READER_LITE
LIVE PREVIEW

ENGR/CS 101 CS Session Lecture 2 Starting with the next class, we - - PowerPoint PPT Presentation

ENGR/CS 101 CS Session Lecture 2 Starting with the next class, we will be using Visual Studio C#. Need at least one volunteer to download VS to their laptop and have it installed by then. Can download the C# Express Edition, link on the


slide-1
SLIDE 1

Lecture 2 ENGR/CS 101 Computer Science Session 1

ENGR/CS 101 CS Session Lecture 2

 Starting with the next class, we will be using

Visual Studio C#. Need at least one volunteer to download VS to their laptop and have it installed by then.

 Can download the C# Express Edition, link on the

CS session webpage

 Can ask Jeff Cron for access to MS Alliance

program site to download full Visual Studio 2010.

slide-2
SLIDE 2

Lecture 2 ENGR/CS 101 Computer Science Session 2

Outline

 Software life cycle  Problem: How to send a secret message?  Codes and ciphers  Substitution ciphers

slide-3
SLIDE 3

Lecture 2 ENGR/CS 101 Computer Science Session 3

Software Life Cycle

 Specification of the problem/task  Analysis and design of a solution  Implementation (coding) of the solution  Testing and debugging  Maintenance and evolution of the system  Obsolescence

slide-4
SLIDE 4

Lecture 2 ENGR/CS 101 Computer Science Session 4

Problem: How to send a secret message?

 Steganography ("concealed writing"): science

  • f sending concealed messages. Includes

physical concealment like invisible ink, microdots...

 Cryptography ("hidden writing"): how to

  • bscure message so it cannot be read even if
  • intercepted. Use codes and ciphers.
slide-5
SLIDE 5

Lecture 2 ENGR/CS 101 Computer Science Session 5

Codes and Ciphers

 Code: whole words or phrases replaced by a

word, letter, or a number. Like an alien language; uses translation code book.

 Cipher: individual letters are replaced by other

letters or symbols.

 Plaintext: message in normal language  Ciphertext: message in secret form

slide-6
SLIDE 6

Lecture 2 ENGR/CS 101 Computer Science Session 6

Ciphers

 Transposition cipher: rearrange letters of

message.

 Scytale: strip of writing material wrapped around a

dowel; write message across dowel.

 Block: arrange message into a block, rewrite

vertical lines

 Substitution cipher: replace letters with other

letters

slide-7
SLIDE 7

Lecture 2 ENGR/CS 101 Computer Science Session 7

Cipher = Algorithm + Key

 Algorithm: a series of well-defined steps that

can be followed as a procedure.

 Key: auxiliary information used by an algorithm.

Different keys produce different ciphers using the same algorithm.

slide-8
SLIDE 8

Lecture 2 ENGR/CS 101 Computer Science Session 8

Caesar Shift Cipher

 Algorithm: substitute a letter with the letter n

places to the right

 Key: letter to shift 'A' to that is n places to the

  • right. E.g. A -> I is shifting 8 places to the right:

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

slide-9
SLIDE 9

Lecture 2 ENGR/CS 101 Computer Science Session 9

In-class Exercise

 Practice enciphering and deciphering using

Caesar shift cipher.

 Turn in at the end of class.

slide-10
SLIDE 10

Lecture 2 ENGR/CS 101 Computer Science Session 10

What if the key is unknown?

 How many possible keys are there for the

Caesar Shift Cipher?

slide-11
SLIDE 11

Lecture 2 ENGR/CS 101 Computer Science Session 11

What if the key is unknown?

 26. (If we include A->A as a possible key.)  Small enough that we could try each one in a

short amount of time.

slide-12
SLIDE 12

Lecture 2 ENGR/CS 101 Computer Science Session 12

Polyalphabetic Ciphers

 Make cipher harder to break by using multiple

substitution alphabets

 Vigenere cipher: key is a "word" rather than just

a single letter. Algorithm is to use the key letters to change Caesar cipher shift key for each letter of plaintext. E.g. for key = "LION", encipher first letter with key A->L, encipher second letter with key A->I, etc.

slide-13
SLIDE 13

Lecture 2 ENGR/CS 101 Computer Science Session 13

Polyalphabetic Ciphers

 Suppose we allow any letter to be substituted

by any other letter? The key would a substitution table mapping each letter to another letter.

 How many possible keys are there for this

cipher?

slide-14
SLIDE 14

Lecture 2 ENGR/CS 101 Computer Science Session 14

Polyalphabetic Ciphers

 26! = 403 291 461 126 605 635 484 000 000.

Over 400 million billion billion.

 Just how big is this number?  6.5 billion people on Earth; 31 million seconds

in a year. If everyone on Earth checked one key per second, ...

slide-15
SLIDE 15

Lecture 2 ENGR/CS 101 Computer Science Session 15

400 million billion billion

 It still would take around 2 billion years to

check them all!

 We can conclude that checking every possible

key is not a feasible way of trying to decipher an arbitrary substitution cipher.

slide-16
SLIDE 16

Lecture 2 ENGR/CS 101 Computer Science Session 16

A better way to decipher

 English letter

frequency: E, T, A, O, ...

 Common words:

"the", "and", ...

 One/two letter

words: "I", "a", "to", "of", ...

 Repeated letters  Context

slide-17
SLIDE 17

Lecture 2 ENGR/CS 101 Computer Science Session 17

Enigma Machine

 Random substitution cipher

represented using a code

  • wheel. Originally 3 code

wheels, later 5 wheels

 Instead of always starting with

same letter on wheel as A, just encipher the current letter of plaintext with the next letter on wheel

 Add a plugboard to further

randomize.