CS255: Introduction to Cryptography

From the author: Wars were were often decided by encryption, for example watch the video on WW2 encryption machines. There were not ‘started’ by encryption. encryption is just another important weapon.

Khan Academy does not support this browser.

To use Khan Academy you need to upgrade to another web browser. Just select one of the options below to start upgrading.

If you’re seeing this message, it means we’re having trouble loading external resources on our website.

If you’re behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Computer science

Course: Computer science > Unit 2

Lesson 1: Ancient cryptography
What is cryptography?
The Caesar cipher
Caesar Cipher Exploration
Frequency Fingerprint Exploration
Polyalphabetic cipher
Polyalphabetic Exploration
The one-time pad
Perfect Secrecy Exploration
Frequency stability property short film
How uniform are you?
The Enigma encryption machine
Perfect secrecy
Pseudorandom number generators
Random Walk Exploration
© 2023 Khan Academy

What is cryptography?

0 energy points
About About this video Transcript

Cryptography has a rich history and plays a crucial role in modern communication networks. Learn about data encryption techniques through an example where Alice and Bob use secret codes (ciphers) to communicate privately. We’ll learn about how encryption (locking messages) and decryption (unlocking messages) protect information from eavesdroppers like Eve.

. Created by Brit Cruise .

Questions Tips & Thanks

Want to join the conversation?

11 years ago
Posted 11 years ago. Direct link to AT’s post “Isn’t this used when payi. ”
Isn’t this used when paying over the internet?
6 comments Comment on AT’s post “Isn’t this used when payi. ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
11 years ago
Posted 11 years ago. Direct link to plunkett.c.e’s post “Yes, safe internet purcha. ”

Yes, safe internet purchases involve encryption. When you buy something through an insecure network, though, encryption might not be used, therefore making it possible for someone to take your information.

Button opens signup modal
Button opens signup modal
Button opens signup modal
11 years ago
Posted 11 years ago. Direct link to Kyle’s post “How exactly do people rea. ”

How exactly do people read peoples private messages (electronically, and non-electronically? And do they do it without letting the people sending and receiving messages know about it?

5 comments Comment on Kyle’s post “How exactly do people rea. ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
11 years ago
Posted 11 years ago. Direct link to ExpiredPopsicle’s post “Sending information over . ”

Sending information over the internet is equivalent to writing a message on a postcard and sending it through the mail in that anyone in the post office (or internet service provider) can snoop on your private messages just by looking at it.

Software programs called packet sniffers can let a user see any information that reaches their network card on their computer, and older networking equipment (hubs and coaxial networks) would naively broadcast all that information to everyone connected to it, with the assumption that each computer would just screen out any information that wasn’t meant for it.

That hardware is less common now as more advanced (and faster) “switches” gradually replaced hubs. Switches are designed to only send the data to the intended computer. It is possible to fool a switch into sending the data to places it shouldn’t go, but it requires that the eavesdropper actively tamper with the network, making it possible for them to be detected.

5 comments Comment on ExpiredPopsicle’s post “Sending information over . ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
11 years ago
Posted 11 years ago. Direct link to osa’s post “In 1:12 Brit talks about . ”

1:12

Brit talks about wars that were started and fueled by encryption. What wars might these be?
3 comments Comment on osa’s post “In 1:12 Brit talks about . ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
11 years ago
Posted 11 years ago. Direct link to brit cruise’s post “Wars were were often deci. ”

From the author: Wars were were often decided by encryption, for example watch the video on WW2 encryption machines. There were not ‘started’ by encryption. encryption is just another important weapon.

3 comments Comment on brit cruise’s post “Wars were were often deci. ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
10 years ago
Posted 10 years ago. Direct link to Miguel Acero’s post “I am very interested in c. ”

I am very interested in cryptography and i really hope this series takes off, a question though; couldn’t cryptography be used unethically in malware/virus’s ?

3 comments Comment on Miguel Acero’s post “I am very interested in c. ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
9 years ago
Posted 9 years ago. Direct link to Syed Fahad’s post “Yes, hackers use encrypti. ”

Yes, hackers use encryption (sometimes simple XOR encryption) to encrypt shell code. When the shell code is in need by malware, it is decrypted by an internal function and executed on machine. This makes it very tough for anti-viruses to detect malware without executing them.

Button opens signup modal
Button opens signup modal
Button opens signup modal
11 years ago
Posted 11 years ago. Direct link to JB’s post “Where does encoding come . ”

Where does encoding come into play. Is this part of creating the “cypher?” Technically it is different from encrypting? Am I right I always confuse the two?

3 comments Comment on JB’s post “Where does encoding come . ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
11 years ago
Posted 11 years ago. Direct link to Peter Collingridge’s post “Encoding and encrypting a. ”

Encoding and encrypting are often used interchangeably. I would say that encrypting is used when you want to prevent some people from understanding a message, while encoding is when you want to transform the message but for it still to be read.

For example a message in English might be encoded using Morse code so it could be transmitted more easily and efficiently. If you thought someone might be listening to the line, you could also encrypt the message, for example, by using a Caesar cypher.

I suppose normally encoding would mean converting the form of the message, from text to binary numbers say. Whilst encrypting would not necessarily change the form, but convert from one set of letters to a different set. However, you can also create cyphers to convert text to numbers or something else that obscures the meaning.

2 comments Comment on Peter Collingridge’s post “Encoding and encrypting a. ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
7 years ago
Posted 7 years ago. Direct link to Abhishek Suresh’s post “Can’t people make their o. ”

Can’t people make their own languages to communicate secretly. It is very much possible. Cryptography wont help there.

Button opens signup modal
Button opens signup modal
Button opens signup modal
7 years ago
Posted 7 years ago. Direct link to Piquan’s post “There are things like the. ”

There are things like the Navajo Wind Talkers that do similar things. However, modern code-breaking and linguistic analysis techniques can help still. In similar ways, we sometimes find ancient books in languages we don’t know, and slowly analyze them to understand what they are saying.

For example, suppose that you can eavesdrop on a spy’s communications, but don’t know what the words mean. You get the local newspaper to put in a fake story that there will be no water the next week. Then, you see the spy write a message that includes the word “kai” several times, when he never used the word “kai” before. Now, you suspect that the word “kai” means “water”. (The US did something similar in World War II, which helped the Allies turn the tide of the war; see https://en.wikipedia.org/wiki/Battle_of_Midway#Allied_code-breaking .)

One common mistake among early cryptographer enthusiasts is to make a new “language” that’s just an old language with the letters changed. My friends and I used to pass notes in invented ciphers like that, just as practice breaking codes!

If you invent a language that’s close to other human languages – such as if it has the same sentence structure as Sanskrit – then it becomes a lot easier to figure out how the language works.

1 comment Comment on Piquan’s post “There are things like the. ”
Button opens signup modal
Button opens signup modal
Button opens signup modal
2 years ago
Posted 2 years ago. Direct link to maxkim0605’s post “I heard that there are so. ”

I heard that there are some games that are known to be “NP-perfect” problems. What i want to ask is if it is possible to make a cipher using the board game Rush hour, by matching a random sentence to a distribution of cars in a certain size of the board.

Button opens signup modal
Button opens signup modal
Button opens signup modal
2 years ago
Posted 2 years ago. Direct link to Cameron’s post “When converting any probl. ”

When converting any problem into a cipher, you need to think about, how three things are represented:
-message text
-key
-cipher text

I haven’t played Rush Hour before, so this might not exactly work with the rules as I’ve written, but you’ll probably get the idea of how to go about these kind of things.

So, presumably we want to make the solution to the rush hour puzzle the key. If we know the solution, this should give us the key to convert the cipher text into message text. It’s important that we only use solutions that are unique, to prevent ambiguous decoding i.e. we don’t want to have more than one possible message.

Presumably, we want the cipher text to involve the puzzle. So, we could possibly make the cipher text, the initial board set up, and then we say that a piece can only be moved 1 space per turn. Every turn we overlay a different grid of letters on the board.

So, the message text is revealed by the spot a piece moved to (newly covered) that turn.

So, would this be a strong cipher ?
Probably not, for the following reasons:
– The beginning and ending moves are probably easy to solve. This makes it susceptible to leaking info from the front and end of the message. Padding the message front and back could help prevent this.
-Since it is a logic type problem, each move is dependent on the previous moves. This tends to make the difficult of each move add rather than multiply. It also makes a leak of 1 bit of the key reduce the strength of the key by more than 1 bit.

Introduction to Cryptography

Logo

Cryptography is an indispensable tool for protecting information in computer systems. This course explains the inner workings of cryptographic primitives and how to use them correctly.

Administrative

Course syllabus (and readings)
Course overview (grading, textbooks, coursework, exams)

Lectures: Monday, Wednesday, 1:30-2:50pm, Gates B01
Sections: Friday, 4:30-5:20pm, room 160-B40.
Questions for CAs: [email protected] or use Ed Discussion
Videos: cs255 online (for video lectures and slides covering the material in class)

Final Exam

The final exam will be a take home exam. You will have three hours in a 24 hour window to complete the exam. Please use gradescope to submit your answers.

The exam will take place on Wed, March 22, 2023, beginning at 9am PT.

Previous final exams:

Homework

All homework submission is to be done via Gradescope. Please use course code PX6887 to sign up. Note that Gradescope requires that the solution to every problem start on a new page.

15356/15856: Introduction to Cryptography

Important Note regard Change in Course Numbers: This course used to be 15503/15827. The course numbers have changed (however the content would remain the same). This course would still satisfy all requirements which 15503/15827 used to (e.g., for security and theory concentrations).

Instructor

Vipul Goyal
Important: Please CC the TAs on ALL emails

Time

MW 1:30pm – 2:50pm

Location

CMU Remote (Zoom)

TAs

Office Hours

TA: (Lisa) Tuesday 3pm to 4pm, (Justin) Wednesday 8:30am to 9:30am
Instructor: Monday 3pm to 4pm

NOTE: please join the class on piazza. Here is a direct link. All further course material and updates will only be posted on piazza.

Prerequisites

This is an introduction to cryptography course. The course is open to graduate and undergraduate students. It is cross-listed with 15-856. This is the website for both the course sections. The course does not assume any prior background in cryptography or computer security. However a basic level of mathematical maturity is expected. It is recommended that you must have taken a course either in: algorithms or theoretical computer science (such as 15-251) or probability/discrete math (such as 21-228).

Currently the prerequisites for this course are 15-251 (OR) 21-228. However if you haven’t taken either of these course but you still believe you can handle the material (e.g., because you did very well in 15-151 or you have special interest in Crypto), please enroll in the waitlist and send the instructor an email.

Grading Policy

Grading policy for both the sections is the same:

5 Homeworks : 10% each
Midterm (in class): 25%
Final (take home): 25%
Class participation and attendance: extra credits (up to 5%)
Improve lecture notes: extra credits (up to 10%)

Exams

2 hour in class midterm: 10/26/2020 covering material up to 10/14/2020 (Tentative Time: 1:30pm to 3:30pm)

Final Exam (take home): 12/14/2020 noon to 12/15/2020 midnight (36 hours given to accommodate other finals)

Tentative List of Lectures

Date

Topic

Description

Relevant Reading

Course focus, prerequisites, what will be covered, what is expected

Classical Ciphers and Perfect Secrecy

Classical ciphers and why they were all broken, one-time pad, moving to modern cryptography based on hard problems like factoring

One Way Functions

Definitions, motivation, candidate constructions

Pseudorandom generators (PRG), computational indistinguishability

Constructing PRGs, Hybrid arguments

Pseudorandom functions (PRF), constructions

Defining encryption, why all deterministic encryption schemes are insecure, construction using PRF, a warning regarding mauling attacks

Number theory and hardness assumptions

Groups, Euler’s function, discrete log problem, RSA function

Diffie-Hellman Key exchange, proof of security

Public-Key Encryption – I

Definition, trapdoor permutations, RSA based construction

Public-Key Encryption – II

El-Gamal encryption, others

MAC and Hash Functions

Message Authentication Codes (MAC), Collision-resistant hash functions (CRHF), constructions

Message Digital Signatures, constructions

XOR secret sharing, Shamir Secret Sharing, Applications

In Class Midterm (2 hours)

Covers material up to 10/09, Open book

Solutions from Midterm and selected homework problems

What are Blockchains, how mining works

Merkle Tree, Smart Contracts, applications and limitations of Bitcoins

Other interesting Blockchains and cryptocurrencies, GHOST, DAG based blockchains

Zero-Knowledge Proofs – I

What is zero-knowledge (ZK), notion of simulation, Graph Isomorphism

Zero-Knowledge Proofs – II

Zero-Knowledge Proofs – III

ZK for any NP statement

Secure Computation – I

Yao’s millionaire problem, 1-out-of-2 oblivious transfer

Secure Computation – II

Coin-Flipping, ZK proofs of honesty, secure computation for small inputs

Secure Computation – III

Yao’s garbled circuits, additional topics

Useful Reading

Look at previous versions of this course for a list of topics covered + lecture notes:

There is no required textbook for the course. Following is some other recommended material for the course:

  • Recommended Lecture notes 1: Scribes / Lecture notes by Omkant Pandey
  • Recommended Lecture notes 2: Lecture notes by Abhishek Jain
  • Other lecture notes: Pass- Shelat , Bellare-Goldwasser
  • Katz and Lindell’s book: Introduction to Modern Cryptography (not free)
  • Rosulek’s upcoming book: The Joy of Cryptography
  • Boneh and Shoup’s upcoming book: A Graduate Course in Applied Cryptography