 Caesar used to encrypt his messages using a very simple algorithm, which could be easily decrypted if you know the key.  He would take each letter.

Slides:



Advertisements
Similar presentations
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesThe Mighty Mod.
Advertisements

Cryptography encryption authentication digital signatures
Using Cryptography to Secure Information. Overview Introduction to Cryptography Using Symmetric Encryption Using Hash Functions Using Public Key Encryption.
Math for Liberal Studies.  When we studied ID numbers, we found that many of these systems use remainders to compute the check digits  Remainders have.
Computer Science 101 Data Encryption And Computer Networks.
Cryptology  Terminology  plaintext - text that is not encrypted.  ciphertext - the output of the encryption process.  key - the information required.
22C:19 Discrete Structures Integers and Modular Arithmetic
Section 3.8: More Modular Arithmetic and Public-Key Cryptography
What is Elliptic Curve Cryptography?
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
Creating Secret Messages. 2 Why do we need to keep things secret? Historically, secret messages were used in wars and battles For example, the Enigma.
CC3.12 Erdal KOSE Privacy & Digital Security Encryption.
Connecting with Computer Science, 2e
1 Day 04- Cryptography Acknowledgements to Dr. Ola Flygt of Växjö University, Sweden for providing the original slides.
Professor Jennifer Rexford COS 217
Chapter 13: Electronic Commerce and Information Security Invitation to Computer Science, C++ Version, Fourth Edition SP09: Contains security section (13.4)
LIAL HORNSBY SCHNEIDER
Encryption. Introduction Computer security is the prevention of or protection against –access to information by unauthorized recipients –intentional but.
Decisions in Python Comparing Strings – ASCII History.
1 Introduction to Codes, Ciphers, and Cryptography Michael A. Karls Ball State University.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Chapter 12 Cryptography (slides edited by Erin Chambers)
David Froot.  How do we transmit information and data, especially over the internet, in a way that is secure and unreadable by anyone but the sender.
Cryptography Week-6.
Section 3.6: An Introduction to Cryptography
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 9: Cryptography.
Cryptography Programming Lab
Encryption Encryption encodes information to hide it from everyone else … maintaining your privacy.
MAT 1000 Mathematics in Today's World Winter 2015.
Section 2.1: Shift Ciphers and Modular Arithmetic The purpose of this section is to learn about modular arithmetic, which is one of the fundamental mathematical.
Systems of Equations as Matrices and Hill Cipher.
Computer Security coursework 2 Dr Alexei Vernitski.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Computing Is Pretty Strange.
Day 18. Concepts Plaintext: the original message Ciphertext: the transformed message Encryption: transformation of plaintext into ciphertext Decryption:
Section 2.1: Shift Ciphers and Modular Arithmetic Practice HW from Barr Textbook (not to hand in) p.66 # 1, 2, 3-6, 9-12, 13, 15.
Symmetric-Key Cryptography
Section 4.4: The RSA Cryptosystem Practice HW Handwritten and Maple Exercises p at end of class notes.
Cryptography Dave Feinberg. Suppose I send an from to Who has access to that ? What if I want the.
CRYPTOGRAPHY. WHAT IS PUBLIC-KEY ENCRYPTION? Encryption is the key to information security The main idea- by using only public information, a sender can.
MAT 1000 Mathematics in Today's World Winter 2015.
Encryption CS110: Computer Science and the Internet.
K. Salah1 Cryptography Module I. K. Salah2 Cryptographic Protocols  Messages should be transmitted to destination  Only the recipient should see it.
Cryptography.
CS100A, Lecture 13, 15 October CS100A Lecture Oct Discussion of Prelim 2 (Tuesday, 20 October, 7:30-9PM) Rooms for Prelim 2 A-K: Hollister.
Chapter 12: Cryptography MAT 320 Spring Cryptography: Basic Ideas We want to encode information so that no one other than the intended recipient.
An Introduction to Cryptology
1 Cryptography Troy Latchman Byungchil Kim. 2 Fundamentals We know that the medium we use to transmit data is insecure, e.g. can be sniffed. We know that.
Dr. Saatchi, Seyed Mohsen 1 Arab Open University - AOU T209 Information and Communication Technologies: People and Interactions Sixth Session.
Introduction to Cryptography Hyunsung Kim, PhD University of Malawi, Chancellor College Kyungil University February, 2016.
Encryption with Keys and Passwords
Modular Arithmetic with Applications to Cryptography
ENCODING AND SENDING FORMATTED TEXT
Binary 1 Basic conversions.
Encryption.
Vocabulary Big Data - “Big data is a broad term for datasets so large or complex that traditional data processing applications are inadequate.” Moore’s.
Whatcha doin'? Aims: To understand the Caesar Cipher.
(Tuesday, 20 October, 7:30-9PM) Encryption-Decryption
Chapter 30 Cryptography Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Representing Nonnumeric Data
M3: Encryption r By Andrew Stringer.
Public Key Cryptography
Encryption and Decryption
National Cipher Challenge
Fundamentals of Data Representation
Simple Encryption- Lesson 5
Fun with Cryptography The Science of Secrecy.
National Cipher Challenge
Binary CSCE 101.
Presentation transcript:

 Caesar used to encrypt his messages using a very simple algorithm, which could be easily decrypted if you know the key.  He would take each letter of the alphabet and replace it with a letter a certain distance away from that letter. When he got to the end, he would wrap back around to the beginning.  Example with a shift of 3: ABCDEFGHIJKLMNOPQRSTUVWXYZ DEFGHIJKLMNOPQRSTUVWXYZABC I’m so sneaky!

 That’s fine! If you know what the shift is, you can use something called modulo, which is commonly shortened to mod.  Let’s say we wanted to find 8 mod 5. We would divide 8 by 5 and find the remainder. So in this case, 8 mod 5 = 3.  In this case, 5 is called the modulus.  Can you solve these? 19 mod 52 mod 525 mod

 When using a Caesar cipher, you assign each letter to an index starting from 0.  You would then compute the following. (plain letter index + key) mod (total number of letters)  This will give you the index of the encrypted letter!  As you can see, the modulus is the total number of letters in the alphabet. For English, this modulus is 26. ABCDEFGHIJKLMNOPQRSTUVWXYZ

 Let’s say we have a 5 letter alphabet with only the letters A-E  First, we assign each letter an index, starting from 0.  We then have to choose a key. For this example, we’ll use 2.  Let’s try encoding the word BEAD using the formula for the previous slide.  The index of the letter B is 1. The key is 2. The modulus is 5, since the alphabet is 5 letters.  Let’s use the algorithm: (1+2) = 3. 3 mod 5 = 3. The index of D is 3, so B would become the letter D.  Using algorithm on each letter, can you encode the full word? DBCA ABCDE 01234

 The mod accounts for wrapping back around once you reach the end of the alphabet.  When converting the letter E using the key 2, you first add 4 + 2, which gives you 6. As you can see, the index 6 is beyond the scope of this alphabet. When you do 6 mod 5, you get the remainder of 1, which is how much you need to go back and count from the beginning of the alphabet. ABCDE 01234

 To decode, you do the following: (cipher letter index – key + total number of letters) mod (total number of letters)  Does anyone know why we can’t just do: (cipher letter index – key) mod (total number of letters)?  By adding the total number of letters, you don’t have to end up taking the mod of a negative number.  See if you can decode DBCA to get back to the word BEAD.

 It’s unbelievably simple!  The mod function is one of the most basic components of a lot of programming languages. You’ll learn the mod function for python early on. That means all we have to deal with is indexing the letters.  Believe it or not, this also is no problem. The solution lies in ASCII.

 Computers have to represent everything as numbers, including things as basic as text.  ASCII is the standard character encoding scheme, where each symbol is assigned a number.  These symbols range from upper and lower case letters to numbers to things like punctuation and arrows. There are many tables online that allow you to look up the number associated with each symbol. Numbers associated with letters? This sounds strangely familiar…

 You probably noticed that the letter A is associated with the number 65, B with 66, C with 67, and so on.  Most programming languages have a function that can take a letter and find out it’s ASCII value.  What would you need to do to make the ASCII encoded letters usable for Caesar’s Cipher?  Subtract 65 from each letter!  Since it’s really simple to code for a computer to use mod and assign the correct index for each letter, you can probably see how programming a simple encoder/decoder would be a cinch!

 It’s too easy to break! Let’s go back to our five letter alphabet.  Say you had the word DBCA, but didn’t know the key. It would be easy to make a list of all possible keys. If you expected the unencrypted text to be in English, you could easily figure out which word was right:  If you were using the full English alphabet, this would take longer, but for someone trying to find our your secret, it’s a small price to pay! Shift of 1CABE Shift of 2BEAD  The clear winner! Shift of 3ADEC Shift of 4ECDB How dare you insult my cipher! Though, you have a good point…

 We can apply what we’ve learned about encryption to pictures too!  As you may have noticed when using Photoshop, colors are determined by concentrations of red, green, and blue. The amount of each color is represented by a digit between 0 and 255.  For instance, red would be represented as (255,0,0) Red Green Blue

 This means that, just like words, we can convert all of our colors into numbers! This is helpful for encryption.  For instance, let’s say that one pixel of your image has a color value of (253,244,3). It looks like this:

 We want to send this color to someone else safely- do you have any idea how we can do this?  We can use a secret code, just like before!  Like the alphabet, we can shift our color values.  In this case, we are going to add another color’s value to our original value.

+ + = = Notice that adding two color values together is not the same as mixing two colors (like you would when painting).

 What if we add two color values together and their sum is greater than 255?  (60,45,300)  Not a color! The computer wouldn’t know what to do with this information.  This is where mods come in handy- like the Caesar Cipher, we have 256 values. This means that after you add two values together, you need to convert it to mod 256.  (60,45,300)  (60,45,44)

 To decode this color, all the recipient needs to do is subtract the color we added- in this case, we subtract the blue from the light yellow. = -

 We just encoded and decoded one pixel. We can apply this to an entire picture by adding one image to another.  Think of it this way- You have a photo that you are sending and a photo that is your “key.” As long as the other person has the key, they can subtract it from your encoded photo to get back the original!  This isn’t particularly useful in computer science, however, because there is no way to stop someone from seeing your photo key and decoding it themselves. They could intercept this key (just like they could intercept the photo) if you try to send it to anyone or make it public!

pixel addition

 Cryptography is the study and practice of hiding information. Caesar’s cipher and photo encryption are just two ways to encrypt and decrypt information. They are both too weak for real-world applications.  There are many methods of cryptography that are much more foolproof than these two methods!  Later today, we will learn about one of these methods, RSA (public key) encryption.