SlideShare a Scribd company logo
1 of 43
Download to read offline
Cryptography
Lecture 1
Welcome!
• Crypto is amazing!
– Can do things that seem impossible…
• Crypto is important and pervasive
– It impacts each of us every day
• Crypto is fun!
– Deep theory interacting with practice
– Attackers’ mindset, fun assignments
This is a tough class
• Mathematical prerequisites
– Discrete math, probability, modular arithmetic
– Mathematical maturity
• Definitions, theorems, proofs, abstraction
• CS prerequisites
– Pseudocode/algorithms, big-O notation
– Programming assignments
• Hard part should not be the programming, but the
thought behind it
• Some flexibility in language, but need to read code I
provide
Tips for doing well
• Read relevant sections of book
before class
– Lecture will move quickly; I expect
questions and discussion
– If you fall behind on the reading it will
be hard to catch up!
– Can also watch my videos on Coursera
• Attend class
• Come to office hours
Necessary administrative
stuff
• Course webpage:
http://www.cs.umd.edu/~jkatz/crypto/s22
– General information posted there
– Syllabus/schedule/readings posted there
• Midterm already scheduled
• Updated as semester progresses
– Slides posted there after lecture, but I will
use the whiteboard in class
Necessary administrative
stuff
• ELMS/Canvas
– HWs will be posted on ELMS
– Professor/TA Zoom links posted there
– Lectures will not be recorded
• Piazza
– Announcements will be sent there
– Useful for discussions/questions
– Please use also for questions about the
content, not just about the homeworks!
Lectures
• In-person lectures (unless campus
policy changes)
• Lectures will not be recorded
• I advise you to attend in person
unless you are sick
Homeworks
• HWs submitted using Gradescope
– Make sure you are registered, and can submit,
well in advance of the first deadline
• When applicable:
– Type solutions using LaTeX (preferred)
– Clear scan of neat handwritten solutions
– Word doc converted to pdf
– .txt files
• Cheating will not be tolerated
– Must write your own code/solutions
– No consulting external websites
HWs/exams
• Expect HWs every 1.5-2 weeks
– Ungraded/optional HWs focusing on the theory
• Solutions given
– Graded HWs involving programming
• Meant to reinforce the abstract concepts
• Meant to highlight practical applications
• Fun!
• Midterm and final
– Questions more similar to ungraded HWs
– Anything covered in class or listed in readings
on syllabus is fair game
Textbook
• Required textbook: “Introduction to
Modern Cryptography, 3rd
edition,”
Katz and Lindell
• Exams will be open book
– Physical copies only; no electronic
devices
Grading
• Grading based on 7-8 HWs (25%),
midterm (35%), and final (40%)
– Exams count a lot
• Class is not curved
– Each student’s grade determined by how well
they demonstrate their understanding of the
material
– Every student is capable of getting an A
– You are not competing with each other
A: 86-100
B: 70-85
C: 55-69
D/F: below
55
TAs
• Doruk Gur
• Guanhong Wang
• Office hours listed on webpage
– May change as semester progresses
How to reach me
• Best way to contact me is by email:
jkatz@cs.umd.edu
• Please put “CMSC 456” in subject
line
• Please email me in advance if you
plan to come to office hours
• Questions?
• Please ask questions throughout!
Course goals
• Understand the theoretical foundations
for real-world cryptography
• When you encounter crypto in your
career:
– Understand the key terms
– Understand the security guarantees
needed/provided
– Know how to use crypto
– Understand what goes on “under the hood”
• “Crypto mindset”
Course non-goals
• Designing your own crypto schemes
– This is hard!
• Implementing crypto for real-world
use
– This is hard!
•Course goal:
realize when to consult an expert!
Cryptography (historically)
“…the art of writing or solving
codes…”
• Historically, cryptography focused
exclusively on ensuring private
communication
between two parties sharing secret
information in advance using “codes”
(aka
private-key encryption)
Modern cryptography
• Much broader scope!
– Data integrity, authentication, protocols, …
– The public-key setting
– Group communication
– More-complicated trust models
– Foundations (e.g., number theory,
quantum-resistance) to systems (e.g.,
electronic voting, privacy-preserving ML,
blockchain, DeFi)
Modern cryptography
Design, analysis, and implementation of
mathematical techniques for securing
information, systems, and distributed
computations against adversarial attack
Cryptography (historically)
“…the art of writing or solving
codes…”
• Historically, cryptography was an art
– Heuristic, unprincipled design and
analysis
– Schemes proposed, broken, repeat…
Modern cryptography
• Cryptography is now much more of a
science
– Rigorous analysis, firm foundations,
deeper understanding, rich theory
• The “crypto mindset” has permeated
other areas of computer security
– Threat modeling
– Proofs of security
Cryptography (historically)
• Used primarily for
military/government applications,
plus a few niche applications in
industry (e.g., banking)
Modern cryptography
• Cryptography is ubiquitous!
– Password-based authentication, password
hashing
– Secure credit-card transactions over the
internet
– Encrypted WiFi
– Disk encryption
– Digitally signed software updates
– Bitcoin
– …
Rough course outline
• Building blocks
– Pseudorandom (number) generators
– Pseudorandom functions/block ciphers
– Hash functions
– Number theory
Secrecy Integrity
Private-key
setting
Private-key
encryption
Message
authentication
codes
Public-key
setting
Public-key
encryption
Digital signatures
Classical Cryptography
Motivation
• Allows us to “ease into things…,”
introduce notation
• Illustrates why things are more
difficult than they may appear
• Motivates a more rigorous approach
Classical cryptography
• Until the 1970s, exclusively
concerned with ensuring secrecy of
communication
• I.e., encryption
Classical cryptography
• Until the 1970s, relied exclusively on
secret information (a key) shared in
advance between the communicating
parties
Private-key cryptography
– aka secret-key / shared-key / symmetric-
key cryptography
Private-key encryption
k k
c
key
m
c  Enck(m)
message/plaintext
encryption
ciphertext
m := Deck(c)
decryption
key
Private-key encryption
k
c
m
c  Enck(m)
m := Deck(c)
k
c
c
Private-key encryption
• A private-key encryption scheme is defined
by a message space M and algorithms (Gen,
Enc, Dec):
– Gen (key-generation algorithm): outputs kK
– Enc (encryption algorithm): takes key k and
message
mM as input; outputs ciphertext c
c  Enck(m)
– Dec (decryption algorithm): takes key k and
ciphertext c as input; outputs m or “error”
m := Deck(c)
For all mM and k output by
Gen,
Deck(Enck(m)) = m
Kerckhoffs’s principle
• The encryption scheme is not secret
– The attacker knows the encryption scheme
– The only secret is the key
– The key must be chosen at random; kept secret
• Arguments in favor of this principle
– Easier to keep key secret than algorithm
– Easier to change key than to change algorithm
– Standardization
• Ease of deployment
• Public scrutiny
The shift cipher
• Consider encrypting English text
• Associate ‘a’ with 0; ‘b’ with 1; …; ‘z’
with 25
• k  K = {0, …, 25}
• To encrypt using key k, shift every letter
of the plaintext by k positions (with
wraparound)
• Decryption just does the reverse
helloworldz
ccccccccccc
jgnnqyqtnfb
Modular arithmetic
• x = y mod N if and only if N divides x-y
• [x mod N] = the remainder when x is divided by
N
– I.e., the unique value y{0, …, N-1} such that
x = y mod N
• 25 = 35 mod 10
• 25 ≠ [35 mod 10]
• 5 = [35 mod 10]
The shift cipher, formally
• M = {strings over lowercase English
alphabet}
• Gen: choose uniform k{0, …, 25}
• Enck(m1…mt): output c1…ct, where
ci := [mi + k mod 26]
• Deck(c1…ct): output m1…mt, where
mi := [ci - k mod 26]
• Can verify that correctness holds…
Is the shift cipher secure?
• No -- only 26 possible keys!
– Given a ciphertext, try decrypting with
every possible key
– Only one possibility will “make sense”
– (What assumptions are we making here?)
• Example of a “brute-force” or
“exhaustive-search” attack
Example
• Ciphertext uryybjbeyq
• Try every possible key…
– tqxxaiadxp
– spwwzhzcwo
– …
– helloworld
Byte-wise shift cipher
• Work with an alphabet of bytes
rather than (English, lowercase)
letters
– Works natively for arbitrary data!
• Use XOR instead of modular addition
– Essential properties still hold
Hexadecimal (base 16)
He
x
Bits
(“nibble
”)
Decim
al
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
He
x
Bits
(“nibble
”)
Deci
mal
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15
Hexadecimal (base 16)
• 0x10
– 0x10 = 16*1 + 0 = 16
– 0x10 = 0001 0000
• 0xAF
– 0xAF = 16*A + F = 16*10 + 15 = 175
– 0xAF = 1010 1111
ASCII
• Characters often represented in ASCII
– 1 byte/char = 2 hex digits/char
Source: http://benborowiec.com/2011/07/23/better-ascii-table/
Useful observations
• Only 128 valid ASCII chars (128 bytes
invalid)
• Only 0x20-0x7E printable
• 0x41-0x7a includes all
upper/lowercase letters
– Uppercase letters begin with 0x4 or 0x5
– Lowercase letters begin with 0x6 or 0x7

More Related Content

Similar to lec1.pdf

rsec2a-2016-jheaton-morning
rsec2a-2016-jheaton-morningrsec2a-2016-jheaton-morning
rsec2a-2016-jheaton-morning
Jeff Heaton
 
Image Security System using Image Processing
Image Security System using Image ProcessingImage Security System using Image Processing
Image Security System using Image Processing
SruthiReddy112
 

Similar to lec1.pdf (20)

Cryptography cse,ru
Cryptography cse,ruCryptography cse,ru
Cryptography cse,ru
 
Cryptography-101
Cryptography-101Cryptography-101
Cryptography-101
 
Cryptography - 101
Cryptography - 101Cryptography - 101
Cryptography - 101
 
5967073.ppt
5967073.ppt5967073.ppt
5967073.ppt
 
Lecture6 rsa
Lecture6 rsaLecture6 rsa
Lecture6 rsa
 
rsec2a-2016-jheaton-morning
rsec2a-2016-jheaton-morningrsec2a-2016-jheaton-morning
rsec2a-2016-jheaton-morning
 
Crytography
CrytographyCrytography
Crytography
 
3. Cryptographic Security
3. Cryptographic Security3. Cryptographic Security
3. Cryptographic Security
 
Image Security
Image SecurityImage Security
Image Security
 
Computer and Network Security
Computer and Network SecurityComputer and Network Security
Computer and Network Security
 
Introduction to cryptography part2-final
Introduction to cryptography  part2-finalIntroduction to cryptography  part2-final
Introduction to cryptography part2-final
 
RSA Algorithm - Public Key Cryptography
RSA Algorithm - Public Key CryptographyRSA Algorithm - Public Key Cryptography
RSA Algorithm - Public Key Cryptography
 
DS Lecture-1 about discrete structure .ppt
DS Lecture-1 about discrete structure .pptDS Lecture-1 about discrete structure .ppt
DS Lecture-1 about discrete structure .ppt
 
Quantum cryptography by Girisha Shankar, Sr. Manager, Cisco
Quantum cryptography by Girisha Shankar, Sr. Manager, CiscoQuantum cryptography by Girisha Shankar, Sr. Manager, Cisco
Quantum cryptography by Girisha Shankar, Sr. Manager, Cisco
 
RSA
RSARSA
RSA
 
CNIT 141: 3. Cryptographic Security
CNIT 141: 3. Cryptographic SecurityCNIT 141: 3. Cryptographic Security
CNIT 141: 3. Cryptographic Security
 
Image Security System using Image Processing
Image Security System using Image ProcessingImage Security System using Image Processing
Image Security System using Image Processing
 
Cryptography Introduction
Cryptography IntroductionCryptography Introduction
Cryptography Introduction
 
NBTC#2 - Why instrumentation is cooler then ice
NBTC#2 - Why instrumentation is cooler then iceNBTC#2 - Why instrumentation is cooler then ice
NBTC#2 - Why instrumentation is cooler then ice
 
Class 17
Class 17Class 17
Class 17
 

More from ssuser8b461f (9)

OS-01 intro.pdf
OS-01 intro.pdfOS-01 intro.pdf
OS-01 intro.pdf
 
lec3.pdf
lec3.pdflec3.pdf
lec3.pdf
 
lec2.pdf
lec2.pdflec2.pdf
lec2.pdf
 
2021-1577.pdf
2021-1577.pdf2021-1577.pdf
2021-1577.pdf
 
Quantum factorization.pdf
Quantum factorization.pdfQuantum factorization.pdf
Quantum factorization.pdf
 
VulnScan_PenTest.pdf
VulnScan_PenTest.pdfVulnScan_PenTest.pdf
VulnScan_PenTest.pdf
 
Off-Path-Attacks-Against-PKI.pdf
Off-Path-Attacks-Against-PKI.pdfOff-Path-Attacks-Against-PKI.pdf
Off-Path-Attacks-Against-PKI.pdf
 
Lost-In-The-Loader.pdf
Lost-In-The-Loader.pdfLost-In-The-Loader.pdf
Lost-In-The-Loader.pdf
 
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdfAttacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
 

Recently uploaded

Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
Cherry
 
CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptx
Cherry
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
Cherry
 
Lipids: types, structure and important functions.
Lipids: types, structure and important functions.Lipids: types, structure and important functions.
Lipids: types, structure and important functions.
Cherry
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
Cherry
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
Cherry
 
PODOCARPUS...........................pptx
PODOCARPUS...........................pptxPODOCARPUS...........................pptx
PODOCARPUS...........................pptx
Cherry
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
levieagacer
 
Pteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecyclePteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecycle
Cherry
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
seri bangash
 

Recently uploaded (20)

Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptx
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
 
CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptx
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
 
Site specific recombination and transposition.........pdf
Site specific recombination and transposition.........pdfSite specific recombination and transposition.........pdf
Site specific recombination and transposition.........pdf
 
Lipids: types, structure and important functions.
Lipids: types, structure and important functions.Lipids: types, structure and important functions.
Lipids: types, structure and important functions.
 
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsTransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
 
GBSN - Biochemistry (Unit 3) Metabolism
GBSN - Biochemistry (Unit 3) MetabolismGBSN - Biochemistry (Unit 3) Metabolism
GBSN - Biochemistry (Unit 3) Metabolism
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
 
Taphonomy and Quality of the Fossil Record
Taphonomy and Quality of the  Fossil RecordTaphonomy and Quality of the  Fossil Record
Taphonomy and Quality of the Fossil Record
 
Energy is the beat of life irrespective of the domains. ATP- the energy curre...
Energy is the beat of life irrespective of the domains. ATP- the energy curre...Energy is the beat of life irrespective of the domains. ATP- the energy curre...
Energy is the beat of life irrespective of the domains. ATP- the energy curre...
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
 
PODOCARPUS...........................pptx
PODOCARPUS...........................pptxPODOCARPUS...........................pptx
PODOCARPUS...........................pptx
 
FS P2 COMBO MSTA LAST PUSH past exam papers.
FS P2 COMBO MSTA LAST PUSH past exam papers.FS P2 COMBO MSTA LAST PUSH past exam papers.
FS P2 COMBO MSTA LAST PUSH past exam papers.
 
ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY // USES OF ANTIOBIOTICS TYPES OF ANTIB...
ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY  // USES OF ANTIOBIOTICS TYPES OF ANTIB...ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY  // USES OF ANTIOBIOTICS TYPES OF ANTIB...
ABHISHEK ANTIBIOTICS PPT MICROBIOLOGY // USES OF ANTIOBIOTICS TYPES OF ANTIB...
 
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate ProfessorThyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
Pteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecyclePteris : features, anatomy, morphology and lifecycle
Pteris : features, anatomy, morphology and lifecycle
 
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
 

lec1.pdf

  • 2. Welcome! • Crypto is amazing! – Can do things that seem impossible… • Crypto is important and pervasive – It impacts each of us every day • Crypto is fun! – Deep theory interacting with practice – Attackers’ mindset, fun assignments
  • 3. This is a tough class • Mathematical prerequisites – Discrete math, probability, modular arithmetic – Mathematical maturity • Definitions, theorems, proofs, abstraction • CS prerequisites – Pseudocode/algorithms, big-O notation – Programming assignments • Hard part should not be the programming, but the thought behind it • Some flexibility in language, but need to read code I provide
  • 4. Tips for doing well • Read relevant sections of book before class – Lecture will move quickly; I expect questions and discussion – If you fall behind on the reading it will be hard to catch up! – Can also watch my videos on Coursera • Attend class • Come to office hours
  • 5. Necessary administrative stuff • Course webpage: http://www.cs.umd.edu/~jkatz/crypto/s22 – General information posted there – Syllabus/schedule/readings posted there • Midterm already scheduled • Updated as semester progresses – Slides posted there after lecture, but I will use the whiteboard in class
  • 6. Necessary administrative stuff • ELMS/Canvas – HWs will be posted on ELMS – Professor/TA Zoom links posted there – Lectures will not be recorded • Piazza – Announcements will be sent there – Useful for discussions/questions – Please use also for questions about the content, not just about the homeworks!
  • 7. Lectures • In-person lectures (unless campus policy changes) • Lectures will not be recorded • I advise you to attend in person unless you are sick
  • 8. Homeworks • HWs submitted using Gradescope – Make sure you are registered, and can submit, well in advance of the first deadline • When applicable: – Type solutions using LaTeX (preferred) – Clear scan of neat handwritten solutions – Word doc converted to pdf – .txt files • Cheating will not be tolerated – Must write your own code/solutions – No consulting external websites
  • 9. HWs/exams • Expect HWs every 1.5-2 weeks – Ungraded/optional HWs focusing on the theory • Solutions given – Graded HWs involving programming • Meant to reinforce the abstract concepts • Meant to highlight practical applications • Fun! • Midterm and final – Questions more similar to ungraded HWs – Anything covered in class or listed in readings on syllabus is fair game
  • 10. Textbook • Required textbook: “Introduction to Modern Cryptography, 3rd edition,” Katz and Lindell • Exams will be open book – Physical copies only; no electronic devices
  • 11. Grading • Grading based on 7-8 HWs (25%), midterm (35%), and final (40%) – Exams count a lot • Class is not curved – Each student’s grade determined by how well they demonstrate their understanding of the material – Every student is capable of getting an A – You are not competing with each other A: 86-100 B: 70-85 C: 55-69 D/F: below 55
  • 12. TAs • Doruk Gur • Guanhong Wang • Office hours listed on webpage – May change as semester progresses
  • 13. How to reach me • Best way to contact me is by email: jkatz@cs.umd.edu • Please put “CMSC 456” in subject line • Please email me in advance if you plan to come to office hours
  • 14. • Questions? • Please ask questions throughout!
  • 15. Course goals • Understand the theoretical foundations for real-world cryptography • When you encounter crypto in your career: – Understand the key terms – Understand the security guarantees needed/provided – Know how to use crypto – Understand what goes on “under the hood” • “Crypto mindset”
  • 16. Course non-goals • Designing your own crypto schemes – This is hard! • Implementing crypto for real-world use – This is hard! •Course goal: realize when to consult an expert!
  • 17. Cryptography (historically) “…the art of writing or solving codes…” • Historically, cryptography focused exclusively on ensuring private communication between two parties sharing secret information in advance using “codes” (aka private-key encryption)
  • 18. Modern cryptography • Much broader scope! – Data integrity, authentication, protocols, … – The public-key setting – Group communication – More-complicated trust models – Foundations (e.g., number theory, quantum-resistance) to systems (e.g., electronic voting, privacy-preserving ML, blockchain, DeFi)
  • 19. Modern cryptography Design, analysis, and implementation of mathematical techniques for securing information, systems, and distributed computations against adversarial attack
  • 20. Cryptography (historically) “…the art of writing or solving codes…” • Historically, cryptography was an art – Heuristic, unprincipled design and analysis – Schemes proposed, broken, repeat…
  • 21. Modern cryptography • Cryptography is now much more of a science – Rigorous analysis, firm foundations, deeper understanding, rich theory • The “crypto mindset” has permeated other areas of computer security – Threat modeling – Proofs of security
  • 22. Cryptography (historically) • Used primarily for military/government applications, plus a few niche applications in industry (e.g., banking)
  • 23. Modern cryptography • Cryptography is ubiquitous! – Password-based authentication, password hashing – Secure credit-card transactions over the internet – Encrypted WiFi – Disk encryption – Digitally signed software updates – Bitcoin – …
  • 24. Rough course outline • Building blocks – Pseudorandom (number) generators – Pseudorandom functions/block ciphers – Hash functions – Number theory Secrecy Integrity Private-key setting Private-key encryption Message authentication codes Public-key setting Public-key encryption Digital signatures
  • 26. Motivation • Allows us to “ease into things…,” introduce notation • Illustrates why things are more difficult than they may appear • Motivates a more rigorous approach
  • 27. Classical cryptography • Until the 1970s, exclusively concerned with ensuring secrecy of communication • I.e., encryption
  • 28. Classical cryptography • Until the 1970s, relied exclusively on secret information (a key) shared in advance between the communicating parties Private-key cryptography – aka secret-key / shared-key / symmetric- key cryptography
  • 29. Private-key encryption k k c key m c  Enck(m) message/plaintext encryption ciphertext m := Deck(c) decryption key
  • 30. Private-key encryption k c m c  Enck(m) m := Deck(c) k c c
  • 31. Private-key encryption • A private-key encryption scheme is defined by a message space M and algorithms (Gen, Enc, Dec): – Gen (key-generation algorithm): outputs kK – Enc (encryption algorithm): takes key k and message mM as input; outputs ciphertext c c  Enck(m) – Dec (decryption algorithm): takes key k and ciphertext c as input; outputs m or “error” m := Deck(c) For all mM and k output by Gen, Deck(Enck(m)) = m
  • 32. Kerckhoffs’s principle • The encryption scheme is not secret – The attacker knows the encryption scheme – The only secret is the key – The key must be chosen at random; kept secret • Arguments in favor of this principle – Easier to keep key secret than algorithm – Easier to change key than to change algorithm – Standardization • Ease of deployment • Public scrutiny
  • 33. The shift cipher • Consider encrypting English text • Associate ‘a’ with 0; ‘b’ with 1; …; ‘z’ with 25 • k  K = {0, …, 25} • To encrypt using key k, shift every letter of the plaintext by k positions (with wraparound) • Decryption just does the reverse helloworldz ccccccccccc jgnnqyqtnfb
  • 34. Modular arithmetic • x = y mod N if and only if N divides x-y • [x mod N] = the remainder when x is divided by N – I.e., the unique value y{0, …, N-1} such that x = y mod N • 25 = 35 mod 10 • 25 ≠ [35 mod 10] • 5 = [35 mod 10]
  • 35. The shift cipher, formally • M = {strings over lowercase English alphabet} • Gen: choose uniform k{0, …, 25} • Enck(m1…mt): output c1…ct, where ci := [mi + k mod 26] • Deck(c1…ct): output m1…mt, where mi := [ci - k mod 26] • Can verify that correctness holds…
  • 36. Is the shift cipher secure? • No -- only 26 possible keys! – Given a ciphertext, try decrypting with every possible key – Only one possibility will “make sense” – (What assumptions are we making here?) • Example of a “brute-force” or “exhaustive-search” attack
  • 37. Example • Ciphertext uryybjbeyq • Try every possible key… – tqxxaiadxp – spwwzhzcwo – … – helloworld
  • 38. Byte-wise shift cipher • Work with an alphabet of bytes rather than (English, lowercase) letters – Works natively for arbitrary data! • Use XOR instead of modular addition – Essential properties still hold
  • 39. Hexadecimal (base 16) He x Bits (“nibble ”) Decim al 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 He x Bits (“nibble ”) Deci mal 8 1000 8 9 1001 9 A 1010 10 B 1011 11 C 1100 12 D 1101 13 E 1110 14 F 1111 15
  • 40. Hexadecimal (base 16) • 0x10 – 0x10 = 16*1 + 0 = 16 – 0x10 = 0001 0000 • 0xAF – 0xAF = 16*A + F = 16*10 + 15 = 175 – 0xAF = 1010 1111
  • 41. ASCII • Characters often represented in ASCII – 1 byte/char = 2 hex digits/char
  • 43. Useful observations • Only 128 valid ASCII chars (128 bytes invalid) • Only 0x20-0x7E printable • 0x41-0x7a includes all upper/lowercase letters – Uppercase letters begin with 0x4 or 0x5 – Lowercase letters begin with 0x6 or 0x7