SlideShare a Scribd company logo
1 of 17
Announcements:
 Please pass in Assignment 1 now.
 Assignment 2 posted (when due?)
Questions?
Roll Call
Today: Vigenere ciphers
DTTF/NB479: Dszquphsbqiz Day 5
1. How many possibilities to brute force?
2. What idea is new?
Shift
Affine
Substitution
Vigenere ciphers
 Invented in 1553 by Bellaso
 A different type of complexity
Shift, Affine, and Substitution ciphers are related
Idea: the key is a vector of shifts
 The key and its length are unknown to Eve
Encryption:
 Repeat the vector as many times as needed to get
the same length as the plaintext
 Add this repeated vector to the plaintext.
Example:
Key = hidden (7 8 3 3 4 13).
The recent development of various methods
19 7 4 17 4 2 4 13 19 3…
7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13
0 15 7 20 8 15 1121 22 6 8 811191718161720 1 17 8 25132416172322 2511 11017 7 5
aph uiplvw giiltrsqrub ri znyqrxw zlbkrhf
Vigenere Ciphers
(quiz # now at top) 1
Key
The shift vector isn’t known (of course)
1. With shift ciphers, the most frequent cipher letter is
probably e.
But here, e maps to H, I, L, … (spread out!)
2. The vector’s length isn’t even known!
Consider 4 attacks:
 Known plaintext?
 Chosen plaintext?
 Chosen ciphertext?
 Ciphertext only? (most interesting)
Security
2-3
English letter frequencies
A 0.082
B 0.015
C 0.028
D 0.043
E 0.127
F 0.022
G 0.020
H 0.061
I 0.070
J 0.002
K 0.008
L 0.040
M 0.024
N 0.067
O 0.075
P 0.019
Q 0.001
R 0.060
S 0.063
T 0.091
U 0.028
V 0.010
W 0.023
X 0.001
Y 0.020
Z 0.001
Graph:
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
Ciphertext-only attack
Assume you know the key length, L.
Make any other assumptions you need.
Take 5 min with a partner and devise a
method to break Vigenere.
4
Perhaps yours looks something like this?
Assume we know the key length, L, …
 We’ll see how to find it shortly
Method 1:
 Parse out the characters at positions p = i (mod L)
These have all been shifted the same amount
Do a frequency analysis to find shift
 The most frequent letter should be e, given enough text. Can
verify to see how shift affects other letters.
 This gives the first letter of the key
 Repeat for positions p = 1, p = 2, … p = L-1
 Problem: involves some trial and error.
 For brute force to work, would need to brute force all
letters of key simultaneously: _____ possibilities
Using the whole frequency distribution is more
robust than using a single letter
Do this via dot products of frequency
vectors.
Dot products
Consider A = (0.082 0.015 0.028 0.043 0.127 0.022 0.020 0.061 0.070 0.002
0.008 0.040 0.024 0.067 0.075 0.019 0.001 0.060 0.063 0.091 .
0.028 0.010 0.023 0.001 0.020 0.001);
Ai = A displaced i positions to the right
A0 = (0.082 0.015 0.028 … 0.001 0.020 0.001)
A1 = (0.001 0.082 0.015 0.028 … 0.023 0.001 0.020)
A2 = (0.020 0.001 0.082 0.015 0.028 … 0.023 0.001)
A0 .* A1 = 0.039
A0 .* A0 = 0.066
Ai .* Aj depends on _____ only.
Max occurs when _____.
Why?
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14




i
i
i B
A
B
A
B
A *
.
5-6
Towards another method
Method 1
 Parse out the characters at positions p = 0
(mod L)
These have all been shifted the same amount
Do a frequency analysis to find shift
 The most frequent letter should be e, given enough text.
Can verify to see how shift affects other letters.
 This gives the first letter of the key
 Repeat for positions p = 1, p = 2, … p = L-1
Another method
Method 2
 Parse out the characters at positions p = 0
(mod L)
These have all been shifted the same amount
Get the whole freq. distribution W = (0.05, 0.002, …)
 W approximates A. Calculate
 Max occurs when we got the shift correct.
 This gives the first letter of the key
 Repeat for positions p = 1, p = 2, … p = L-1
 Demo
25
0 

 i
for
A
W i
Method 2 is more robust since it
uses the whole letter distribution
Find dot product of Ai:
and W:
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0 5 10 15 20 25 30
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
7-8
More robust than just using 1 letter (‘e’)…
…but harder to compute by hand.
Finding the key length also uses dot products
Just displace the ciphertext by various
amounts and look for the maximum dot
product
Finding the key length
What if the frequency of letters in the plaintext
approximates A?
Then for each k, the frequency of each group of letters in
position p = k (mod L) in the ciphertext approximates A.
Then loop, displacing the ciphertext by i, and counting
the number of matches.
 Get max when displace by correct key length
 So just look for the max number of matches!
displacement
APHUIPLVWGIILTRSQRUBRIZNYQRXWZLBKRHFVN (0)
NAPHUIPLVWGIILTRSQRUBRIZNYQRXWZLBKRHFV (1) 1 match
VNAPHUIPLVWGIILTRSQRUBRIZNYQRXWZLBKRHF (2) 0 matches
…
KRHFVNAPHUIPLVWGIILTRSQRUBRIZNYQRXWZLB (6) 5 matches
…
Key length: an example
Take any random pair in the ciphertext:
The letter in the top row is shifted by i (say 0)
The letter in the bottom row is shifted by j (say 2)
Prob(both ‘A’) = P(‘a’)*P(‘y’) = 0.082 * 0.020
Prob(both ‘B’) = P(‘b’)*P(‘z’) = 0.015 * 0.001
Prob (both same (any letter)) is ___ or generally ___
Recall, this is maximum when ______
When are each letter in the top and bottom rows shifted
by same amount?
A0 = (0.082 0.015 0.028 … 0.001 0.020 0.001)
A2 = (0.020 0.001 0.082 0.015 0.028 … 0.023 0.001)
The text helps with implementation
Read it. Implement it. You’ll own it.
 You’ll do this on Homework 2:
 Week 3 programming test: use your program
to decrypt a vigenere-encrypted message
Exceptions
Consider Gadsby by Ernest Vincent
Wright, February 1939:
 http://www.spinelessbooks.com/gadsby/01.html
What do you notice about it?

More Related Content

Similar to CTI.Vigenir Cipher.pptx

Similar to CTI.Vigenir Cipher.pptx (20)

F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
 
Mathematical Statistics Assignment Help
Mathematical Statistics Assignment HelpMathematical Statistics Assignment Help
Mathematical Statistics Assignment Help
 
Cryptography
CryptographyCryptography
Cryptography
 
RES701 Research Methodology_FFT
RES701 Research Methodology_FFTRES701 Research Methodology_FFT
RES701 Research Methodology_FFT
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Dynamic Programming - Laughlin Lunch and Learn
Dynamic Programming - Laughlin Lunch and LearnDynamic Programming - Laughlin Lunch and Learn
Dynamic Programming - Laughlin Lunch and Learn
 
L&NDeltaTalk
L&NDeltaTalkL&NDeltaTalk
L&NDeltaTalk
 
Lies, Damned Lies, and Substrings
Lies, Damned Lies, and SubstringsLies, Damned Lies, and Substrings
Lies, Damned Lies, and Substrings
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
defense
defensedefense
defense
 
Faster, More Effective Flowgraph-based Malware Classification
Faster, More Effective Flowgraph-based Malware ClassificationFaster, More Effective Flowgraph-based Malware Classification
Faster, More Effective Flowgraph-based Malware Classification
 
lec2.pdf
lec2.pdflec2.pdf
lec2.pdf
 

More from halosidiq1

my net security and its models which are explained here
my net security and its models which are explained heremy net security and its models which are explained here
my net security and its models which are explained herehalosidiq1
 
new.technique.column transposional CTi college.ppt
new.technique.column transposional CTi college.pptnew.technique.column transposional CTi college.ppt
new.technique.column transposional CTi college.ppthalosidiq1
 
row.coliumn,transitio,.Polyetchnical.colleage.ppt
row.coliumn,transitio,.Polyetchnical.colleage.pptrow.coliumn,transitio,.Polyetchnical.colleage.ppt
row.coliumn,transitio,.Polyetchnical.colleage.ppthalosidiq1
 
symet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.pptsymet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.ppthalosidiq1
 
my lecture 21.network security.2023.ppt
my lecture 21.network security.2023.pptmy lecture 21.network security.2023.ppt
my lecture 21.network security.2023.ppthalosidiq1
 
My Project on Cryptograpghy.2023.ppt
My Project on Cryptograpghy.2023.pptMy Project on Cryptograpghy.2023.ppt
My Project on Cryptograpghy.2023.ppthalosidiq1
 
my.Light weight cryptography.2023.pptx
my.Light weight cryptography.2023.pptxmy.Light weight cryptography.2023.pptx
my.Light weight cryptography.2023.pptxhalosidiq1
 
MyCryptography.2023.ppt
MyCryptography.2023.pptMyCryptography.2023.ppt
MyCryptography.2023.ppthalosidiq1
 
MyTutorialON Cryptography.ppt
MyTutorialON Cryptography.pptMyTutorialON Cryptography.ppt
MyTutorialON Cryptography.ppthalosidiq1
 
new.deadlock.ppt
new.deadlock.pptnew.deadlock.ppt
new.deadlock.ppthalosidiq1
 
CNF.Chap.5.pptx
CNF.Chap.5.pptxCNF.Chap.5.pptx
CNF.Chap.5.pptxhalosidiq1
 

More from halosidiq1 (11)

my net security and its models which are explained here
my net security and its models which are explained heremy net security and its models which are explained here
my net security and its models which are explained here
 
new.technique.column transposional CTi college.ppt
new.technique.column transposional CTi college.pptnew.technique.column transposional CTi college.ppt
new.technique.column transposional CTi college.ppt
 
row.coliumn,transitio,.Polyetchnical.colleage.ppt
row.coliumn,transitio,.Polyetchnical.colleage.pptrow.coliumn,transitio,.Polyetchnical.colleage.ppt
row.coliumn,transitio,.Polyetchnical.colleage.ppt
 
symet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.pptsymet.crypto.hill.cipher.2023.ppt
symet.crypto.hill.cipher.2023.ppt
 
my lecture 21.network security.2023.ppt
my lecture 21.network security.2023.pptmy lecture 21.network security.2023.ppt
my lecture 21.network security.2023.ppt
 
My Project on Cryptograpghy.2023.ppt
My Project on Cryptograpghy.2023.pptMy Project on Cryptograpghy.2023.ppt
My Project on Cryptograpghy.2023.ppt
 
my.Light weight cryptography.2023.pptx
my.Light weight cryptography.2023.pptxmy.Light weight cryptography.2023.pptx
my.Light weight cryptography.2023.pptx
 
MyCryptography.2023.ppt
MyCryptography.2023.pptMyCryptography.2023.ppt
MyCryptography.2023.ppt
 
MyTutorialON Cryptography.ppt
MyTutorialON Cryptography.pptMyTutorialON Cryptography.ppt
MyTutorialON Cryptography.ppt
 
new.deadlock.ppt
new.deadlock.pptnew.deadlock.ppt
new.deadlock.ppt
 
CNF.Chap.5.pptx
CNF.Chap.5.pptxCNF.Chap.5.pptx
CNF.Chap.5.pptx
 

Recently uploaded

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

CTI.Vigenir Cipher.pptx

  • 1. Announcements:  Please pass in Assignment 1 now.  Assignment 2 posted (when due?) Questions? Roll Call Today: Vigenere ciphers DTTF/NB479: Dszquphsbqiz Day 5
  • 2. 1. How many possibilities to brute force? 2. What idea is new? Shift Affine Substitution Vigenere ciphers  Invented in 1553 by Bellaso  A different type of complexity Shift, Affine, and Substitution ciphers are related
  • 3. Idea: the key is a vector of shifts  The key and its length are unknown to Eve Encryption:  Repeat the vector as many times as needed to get the same length as the plaintext  Add this repeated vector to the plaintext. Example: Key = hidden (7 8 3 3 4 13). The recent development of various methods 19 7 4 17 4 2 4 13 19 3… 7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13 7 8 3 3 4 13 0 15 7 20 8 15 1121 22 6 8 811191718161720 1 17 8 25132416172322 2511 11017 7 5 aph uiplvw giiltrsqrub ri znyqrxw zlbkrhf Vigenere Ciphers (quiz # now at top) 1 Key
  • 4. The shift vector isn’t known (of course) 1. With shift ciphers, the most frequent cipher letter is probably e. But here, e maps to H, I, L, … (spread out!) 2. The vector’s length isn’t even known! Consider 4 attacks:  Known plaintext?  Chosen plaintext?  Chosen ciphertext?  Ciphertext only? (most interesting) Security 2-3
  • 5. English letter frequencies A 0.082 B 0.015 C 0.028 D 0.043 E 0.127 F 0.022 G 0.020 H 0.061 I 0.070 J 0.002 K 0.008 L 0.040 M 0.024 N 0.067 O 0.075 P 0.019 Q 0.001 R 0.060 S 0.063 T 0.091 U 0.028 V 0.010 W 0.023 X 0.001 Y 0.020 Z 0.001 Graph: 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14
  • 6. Ciphertext-only attack Assume you know the key length, L. Make any other assumptions you need. Take 5 min with a partner and devise a method to break Vigenere. 4
  • 7. Perhaps yours looks something like this? Assume we know the key length, L, …  We’ll see how to find it shortly Method 1:  Parse out the characters at positions p = i (mod L) These have all been shifted the same amount Do a frequency analysis to find shift  The most frequent letter should be e, given enough text. Can verify to see how shift affects other letters.  This gives the first letter of the key  Repeat for positions p = 1, p = 2, … p = L-1  Problem: involves some trial and error.  For brute force to work, would need to brute force all letters of key simultaneously: _____ possibilities
  • 8. Using the whole frequency distribution is more robust than using a single letter Do this via dot products of frequency vectors.
  • 9. Dot products Consider A = (0.082 0.015 0.028 0.043 0.127 0.022 0.020 0.061 0.070 0.002 0.008 0.040 0.024 0.067 0.075 0.019 0.001 0.060 0.063 0.091 . 0.028 0.010 0.023 0.001 0.020 0.001); Ai = A displaced i positions to the right A0 = (0.082 0.015 0.028 … 0.001 0.020 0.001) A1 = (0.001 0.082 0.015 0.028 … 0.023 0.001 0.020) A2 = (0.020 0.001 0.082 0.015 0.028 … 0.023 0.001) A0 .* A1 = 0.039 A0 .* A0 = 0.066 Ai .* Aj depends on _____ only. Max occurs when _____. Why? 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14     i i i B A B A B A * . 5-6
  • 10. Towards another method Method 1  Parse out the characters at positions p = 0 (mod L) These have all been shifted the same amount Do a frequency analysis to find shift  The most frequent letter should be e, given enough text. Can verify to see how shift affects other letters.  This gives the first letter of the key  Repeat for positions p = 1, p = 2, … p = L-1
  • 11. Another method Method 2  Parse out the characters at positions p = 0 (mod L) These have all been shifted the same amount Get the whole freq. distribution W = (0.05, 0.002, …)  W approximates A. Calculate  Max occurs when we got the shift correct.  This gives the first letter of the key  Repeat for positions p = 1, p = 2, … p = L-1  Demo 25 0    i for A W i
  • 12. Method 2 is more robust since it uses the whole letter distribution Find dot product of Ai: and W: 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0 5 10 15 20 25 30 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 7-8 More robust than just using 1 letter (‘e’)… …but harder to compute by hand.
  • 13. Finding the key length also uses dot products Just displace the ciphertext by various amounts and look for the maximum dot product
  • 14. Finding the key length What if the frequency of letters in the plaintext approximates A? Then for each k, the frequency of each group of letters in position p = k (mod L) in the ciphertext approximates A. Then loop, displacing the ciphertext by i, and counting the number of matches.  Get max when displace by correct key length  So just look for the max number of matches! displacement APHUIPLVWGIILTRSQRUBRIZNYQRXWZLBKRHFVN (0) NAPHUIPLVWGIILTRSQRUBRIZNYQRXWZLBKRHFV (1) 1 match VNAPHUIPLVWGIILTRSQRUBRIZNYQRXWZLBKRHF (2) 0 matches … KRHFVNAPHUIPLVWGIILTRSQRUBRIZNYQRXWZLB (6) 5 matches …
  • 15. Key length: an example Take any random pair in the ciphertext: The letter in the top row is shifted by i (say 0) The letter in the bottom row is shifted by j (say 2) Prob(both ‘A’) = P(‘a’)*P(‘y’) = 0.082 * 0.020 Prob(both ‘B’) = P(‘b’)*P(‘z’) = 0.015 * 0.001 Prob (both same (any letter)) is ___ or generally ___ Recall, this is maximum when ______ When are each letter in the top and bottom rows shifted by same amount? A0 = (0.082 0.015 0.028 … 0.001 0.020 0.001) A2 = (0.020 0.001 0.082 0.015 0.028 … 0.023 0.001)
  • 16. The text helps with implementation Read it. Implement it. You’ll own it.  You’ll do this on Homework 2:  Week 3 programming test: use your program to decrypt a vigenere-encrypted message
  • 17. Exceptions Consider Gadsby by Ernest Vincent Wright, February 1939:  http://www.spinelessbooks.com/gadsby/01.html What do you notice about it?