第7章-传统加密技术
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
• 代换法就是将明文字母替换成其他字母、数字或 符号的方法。
第7章 传统加密技术
Caesar Cipher
• Mathematically give each letter a number
abcdefghijk l m 0 1 2 3 4 5 6 7 8 9 10 11 12 nopqrstuvwxyZ 13 14 15 16 17 18 19 20 21 22 23 24 25
– see if look monoalphabetic or not
• start with letter frequencies 是否满足语言的统计特性
– if not, then need to determine number of alphabets, since then can attach each 密钥词的长度
• effectively multiple Caesar ciphers • key is multiple letters long K = k1 k2 ... kd • ith key letter specifies ith alphabet to use • use each alphabet in turn • repeat from start after d letters in message • decryption simply works in reverse
• Mathematical expression: c = E(p) = (p + 3) mod 26 p = D(c) = (c – 3) mod 26
Cryptanalysis of Caesar Cipher
• 已知加密和解密算法 • 需测试的密钥只有25个 • 明文所用的语言是已知的,且其意义易于识别
Example
• write the plaintext out
• write the keyword repeated above it
• use each key letter as a caesar cipher key
• encrypt the corresponding plaintext letter
Time required at 1 Time required at
decryption/µs
106 decryptions/µs
2 1026 µs
=
6.4 1012 years
6.4 106 years
• Secure ?
– !!!WRONG!!!
Cryptanalysis of monoalphabetic cipher
statistical relationship to the plaintext • since for any plaintext & any ciphertext there
exists a key mapping one to other • problems in generation & safe distribution of key
Kasiski Method
• method developed by Babbage(1854); Kasiski(1863) • repetitions in ciphertext give clues to period
重复次数给出线索 • same plaintext + same keyword same ciphertext
• use each alphabet in turn • repeat from start after end of key is reached
Vigenère Cipher ——此类算法中最著名且最简单的
• simplest polyalphabetic substitution cipher is the Vigenère Cipher
English Letter Frequencies
Language Redundancy
• letters are not equally commonly used • in English E is by far the most common
letter
– followed by T,R,N,I,O,A,S
Z I C V T WQNGRZGVTWAVZHCQYGLMGJ
3行22列
Security of Vigenère Ciphers
• have multiple ciphertext letters for each plaintext letter 每个明文字母对应多个密文字母
• hence letter frequencies are obscured • but not totally lost • Distinguish attack区分单表还是Vigenère的步骤
• guess P as e and Z as t
• guess ZW is th and hence ZWP is the, and ZWSZ is that
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
ta
e e te a that e e a
at
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
• Arabian scientists, 9th century • key concept - monoalphabetic substitution
do not change relative letter frequencies • human languages are redundant
Transposition Ciphers 置换密码
• Hide the message by rearranging the letter order
• without altering the actual letters used • can recognise these since have the same
Plaintext: c a s h n o t n e e d e d 2 0 18 7 13 14 19 13 4 4 3 4 3
key: 25 4 22 3 22 15 19 5 19 21 12 8 4 1 4 14 10 9 3 12 18 23 25 15 12 7
Ciphertext: B E C K J D M S X Z P M H
direct contacts have been made with political
representatives of the vietcong in moscow
多表代换密码 polyalphabetic substitution ciphers
• another approach to improving security is to use multiple cipher alphabets
• makes cryptanalysis harder with more alphabets to guess and flatter frequency distribution
• use a key to select which alphabet is used for each letter of the message
ciphertext letter • key is 26 letters long rather than just 1 letter • e. g.:
abcdefg hijklmn opq rst uvw xyz key: DKVQFIB JWPESCX HTM YAU OLR GZN Plaintext: ifwewishtoreplaceletters Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Example
Plaintext: s e n d m o r e m o n e y 18 4 13 3 12 14 17 4 12 14 13 4 24
key: 9 0 1 7 23 15 21 14 11 11 2 8 9 1 4 14 10 9 3 12 18 23 25 15 12 7
Ciphertext: B E C K J D M S X Z P M H
第7章 传统加密技术
第7章-传统加密技术
主要内容
• 代换密码 – 单表代换密码 – 多表代换密码 – 一次一密 • 置换密码 – 栅栏密码 – 多步置换密码 转轮机Enigma
2.2 Substitution Ciphers(代换密码)
• where letters of plaintext are replaced by other letters or by numbers or symbols
Monoalphabetic Cipher Security
ቤተ መጻሕፍቲ ባይዱ
• Key space: 26!, i.e. about 4 x 1026 possibilities
Key Size (bits)
Number of Alternative
Keys
26 characters 26! = 4 1026 (permutation)
e t ta t ha e ee a e th t a
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
e e e tat e the et
• proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
• other letters like Z,J,K,Q,X are fairly rare • have tables of single, double & triple letter
frequencies for various languages
Example Cryptanalysis*
• Determine the length of key
– E. g. repeated “VTW” in previous example
ZICVTWQNGRZGVTWAVZHCQYGLMGJ
suggests key size of 3 or 9
• Attack each monoalphabetic cipher individually using same techniques as before
• given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
• count relative letter frequencies
• eg using keyword deceptive
plaintext: w e a r e discoveredsaveyourself
22 4 0 17 4…
key:
d e c e p tivedeceptivedeceptive
3 4 2 4 15…
ciphertext:25 8 2 21 19
所以可以采用穷举攻击分析方法
单表代换密码(Monoalphabetic Cipher)
• rather than just shifting the alphabet • could shuffle (jumble) the letters arbitrarily • each plaintext letter maps to a different random
One-Time Pad 一次一密
• if a truly random key as long as the message is used, the cipher will be secure
• One-Time pad, Joseph Mauborgne • the key is used only once • is unbreakable since ciphertext bears no
第7章 传统加密技术
Caesar Cipher
• Mathematically give each letter a number
abcdefghijk l m 0 1 2 3 4 5 6 7 8 9 10 11 12 nopqrstuvwxyZ 13 14 15 16 17 18 19 20 21 22 23 24 25
– see if look monoalphabetic or not
• start with letter frequencies 是否满足语言的统计特性
– if not, then need to determine number of alphabets, since then can attach each 密钥词的长度
• effectively multiple Caesar ciphers • key is multiple letters long K = k1 k2 ... kd • ith key letter specifies ith alphabet to use • use each alphabet in turn • repeat from start after d letters in message • decryption simply works in reverse
• Mathematical expression: c = E(p) = (p + 3) mod 26 p = D(c) = (c – 3) mod 26
Cryptanalysis of Caesar Cipher
• 已知加密和解密算法 • 需测试的密钥只有25个 • 明文所用的语言是已知的,且其意义易于识别
Example
• write the plaintext out
• write the keyword repeated above it
• use each key letter as a caesar cipher key
• encrypt the corresponding plaintext letter
Time required at 1 Time required at
decryption/µs
106 decryptions/µs
2 1026 µs
=
6.4 1012 years
6.4 106 years
• Secure ?
– !!!WRONG!!!
Cryptanalysis of monoalphabetic cipher
statistical relationship to the plaintext • since for any plaintext & any ciphertext there
exists a key mapping one to other • problems in generation & safe distribution of key
Kasiski Method
• method developed by Babbage(1854); Kasiski(1863) • repetitions in ciphertext give clues to period
重复次数给出线索 • same plaintext + same keyword same ciphertext
• use each alphabet in turn • repeat from start after end of key is reached
Vigenère Cipher ——此类算法中最著名且最简单的
• simplest polyalphabetic substitution cipher is the Vigenère Cipher
English Letter Frequencies
Language Redundancy
• letters are not equally commonly used • in English E is by far the most common
letter
– followed by T,R,N,I,O,A,S
Z I C V T WQNGRZGVTWAVZHCQYGLMGJ
3行22列
Security of Vigenère Ciphers
• have multiple ciphertext letters for each plaintext letter 每个明文字母对应多个密文字母
• hence letter frequencies are obscured • but not totally lost • Distinguish attack区分单表还是Vigenère的步骤
• guess P as e and Z as t
• guess ZW is th and hence ZWP is the, and ZWSZ is that
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
ta
e e te a that e e a
at
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
• Arabian scientists, 9th century • key concept - monoalphabetic substitution
do not change relative letter frequencies • human languages are redundant
Transposition Ciphers 置换密码
• Hide the message by rearranging the letter order
• without altering the actual letters used • can recognise these since have the same
Plaintext: c a s h n o t n e e d e d 2 0 18 7 13 14 19 13 4 4 3 4 3
key: 25 4 22 3 22 15 19 5 19 21 12 8 4 1 4 14 10 9 3 12 18 23 25 15 12 7
Ciphertext: B E C K J D M S X Z P M H
direct contacts have been made with political
representatives of the vietcong in moscow
多表代换密码 polyalphabetic substitution ciphers
• another approach to improving security is to use multiple cipher alphabets
• makes cryptanalysis harder with more alphabets to guess and flatter frequency distribution
• use a key to select which alphabet is used for each letter of the message
ciphertext letter • key is 26 letters long rather than just 1 letter • e. g.:
abcdefg hijklmn opq rst uvw xyz key: DKVQFIB JWPESCX HTM YAU OLR GZN Plaintext: ifwewishtoreplaceletters Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Example
Plaintext: s e n d m o r e m o n e y 18 4 13 3 12 14 17 4 12 14 13 4 24
key: 9 0 1 7 23 15 21 14 11 11 2 8 9 1 4 14 10 9 3 12 18 23 25 15 12 7
Ciphertext: B E C K J D M S X Z P M H
第7章 传统加密技术
第7章-传统加密技术
主要内容
• 代换密码 – 单表代换密码 – 多表代换密码 – 一次一密 • 置换密码 – 栅栏密码 – 多步置换密码 转轮机Enigma
2.2 Substitution Ciphers(代换密码)
• where letters of plaintext are replaced by other letters or by numbers or symbols
Monoalphabetic Cipher Security
ቤተ መጻሕፍቲ ባይዱ
• Key space: 26!, i.e. about 4 x 1026 possibilities
Key Size (bits)
Number of Alternative
Keys
26 characters 26! = 4 1026 (permutation)
e t ta t ha e ee a e th t a
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
e e e tat e the et
• proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
• other letters like Z,J,K,Q,X are fairly rare • have tables of single, double & triple letter
frequencies for various languages
Example Cryptanalysis*
• Determine the length of key
– E. g. repeated “VTW” in previous example
ZICVTWQNGRZGVTWAVZHCQYGLMGJ
suggests key size of 3 or 9
• Attack each monoalphabetic cipher individually using same techniques as before
• given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
• count relative letter frequencies
• eg using keyword deceptive
plaintext: w e a r e discoveredsaveyourself
22 4 0 17 4…
key:
d e c e p tivedeceptivedeceptive
3 4 2 4 15…
ciphertext:25 8 2 21 19
所以可以采用穷举攻击分析方法
单表代换密码(Monoalphabetic Cipher)
• rather than just shifting the alphabet • could shuffle (jumble) the letters arbitrarily • each plaintext letter maps to a different random
One-Time Pad 一次一密
• if a truly random key as long as the message is used, the cipher will be secure
• One-Time pad, Joseph Mauborgne • the key is used only once • is unbreakable since ciphertext bears no