ch2 Part1
ch2 Part1
ch2 Part1
Chapter 2
Elementary Cryptography
• R recipient • block
• intercept
• T trans. medium
• modify
• O outsider or intruder
• fabricate
key
Cryptography Cryptanalysis
Letter N O P Q R S T U V W X Y Z
Code 13 14 15 16 17 18 19 20 21 22 23 24 25
r = a mod b
Pfleeger, Security in Computing, ch. 2 22
Cryptographic Elements
• Primitive operations:
• Example:
– P = “Old School cracked me up”
– C = ROG VFKRRO FUDFNHG PH XS
Pfleeger, Security in Computing, ch. 2 26
Another Substitution
• Shift plaintext chars. three characters
A: A B C D E F G H I J K L M
C: D E F G H I J K L M N O P
A: N O P Q R S T U V W X Y Z
C: Q R S T U V W X Y Z A B C
• Example:
– P = “Old School cracked me up”
notice wrap
– C = ROG VFKRRO FUDFNHG PH XS
Pfleeger, Security in Computing, ch. 2 27
Another Substitution
• Shift plaintext chars. three characters
A: A B C D E F G H I J K L M
C: D E F G H I J K L M N O P
A: N O P Q R S T U V W X Y Z
C: Q R S T U V W X Y Z A B C
• review:
– if a and m are positive integers, a mod m is the
remainder when a is divided by m
• Caesar cipher special case of shift cipher
Pfleeger, Security in Computing, ch. 2 30
Shift Cipher
• encryption:
– EK(m) = m + K mod 26
• decryption:
– DK(c) = c – K mod 26
• example: k=5
A: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
C: F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
• “summer vacation was too short” encrypts to
– XZRR JWAF HFYN TSBF XYTT XMTW Y
• How difficult?
• Example:
char: N O P Q R S T U V W X Y Z
pct: 7 8 2 0.25 6.5 6 9 3 1 1.5 0.5 2 0.25
6
5
4
3
2
1
0
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
characters 39
Pfleeger, Security in Computing, ch. 2
Common English Digrams and
Trigrams
Digrams Trigrams
EN ENT
RE ION
ER AND
NT ING
TH IVE
ON TIO
IN FOR
TF OUR
AN THI
OR ONE