






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Definitions
Cryptography
refers to secret communication
(by extension).Codes & Ciphers
are techniques to disguise a
message so that only the intended recipient canread it.Code: disguise
words
, Cipher: disguise
letters
.
Key
is a unique numeric or symbolic sequence
used to encrypt or decrypt information.Security
A good code: Keep the key secretHave lots of potential keys.
Problem of key distribution in a secure way.No code is 100% secure (codebreakers).
Steganography Cryptography
TranspositionSubstitution
MonoalphabeticPolyalphabetic
Secret Encoding
The message is hiddenThe message is scrambled
Each letter in a message retains itsidentity but changes its positionEach letter in a message changes itsidentity but retains its position
Ciphers
The Vigenere Square
It contains all possible Caesar shifts.
Encrypted letters in Caesar Shift 3Decrypted letters
Security Issues: Æ
This code is rather easy to crack! Æ
Small number of possible keys: Æ
Structure of language…. Example 2:
A Caesar shift 3 was used to encrypt thefollowing word. Decrypt it.F
R
P
P
X
Q
L
F
D
W
L
R
Q
Example 3:
A Caesar shift was used to encrypt thefollowing sentence. Decrypt it.U
X U W Q
O T Q Q E Q
Permutation Encoding
Letters are replaced by others in a more“random” way than simply shifting.The mapping is still reversible.Key: mapping for all letters (26 characters) Security Issues: Æ
Better code than Caesar shift. Æ
Many possible keys: 4. 10^ Æ
How to securely distribute the key? Example 4:
A
B
C
D
E
F
G ……………. Z
A
B
C
D
E
F
G
H
I ……… Z
Key =
FAÇADE will be encrypted as:
All monoalphabetic ciphers can be cracked!(using knowledge of language)
Polyalphabetic Ciphers Designed to beat frequency analysis. Vigenere Cipher
(1586)
For each letter in a message, a different cipheralphabet (Caesar shift) is used.Key: is a keytext = sequence of the alphabets used.
Example 5:
E N G I
N
E E
R I N G
Keytext: F D T A U M R P E A G
Encrypt the word
“Le Chiffre Indechiffrable”
Remarks:
Example 7:
Encrypt the text FOO using the
XOR function, and the key ECE. Use the 7-bitASCII coding for the letters.
ECE: 1 0 0 0 1 0 1
1 0 0 0 0 1 1
1 0 0 0 1 0 1
ECE: 1 0 0 0 1 0 1
1 0 0 0 0 1 1
1 0 0 0 1 0 1
Encrypted:
FOO: 1 0 0 0 1 1 0
1 0 0 1 1 1 1
1 0 0 1 1 1 1
Decrypted:To encrypt a longer message: repeat akeyword or use a sequence of keywords messagekeytextencryptedmessage
(bitsnotused)
Security Issues: Æ
It is not a very secure code if the key is a set of words. Better to generate a “random” key (arandom binary sequence).
Modulo Function
A modulo N = A mod Nis the remainder when dividing A by N
0 < A mod N < N-
A = p*N + (A mod N)
remainder
Example 8:
5 mod 8 =10 mod 6 =39 mod 10 = Another way to look at Modulo(example with mod 6)divide a circle in 6 parts: 0 to 5.A modulo 6 is the number onwhich we land when starting at 0,and advancing by “A” positions.
0
(^12)
3
5 4
Try 10 mod 6 again!
Pseudo-Random Number Generator^ This is used to generate the random key(the bit sequence).
X(0) is called the seed, and it is given.X(1), X(2), X(3), … is the key and it isgenerated by using the recursion:
X(k+1) = (A*X(k) + B) mod N
= PRNG(A, B, N)
Some generators are better than others (randomness).
Example 9
: N = 16, B = 6
(a) X(0) = 5, A = 4
X(1) = (4 x
5 + 6) mod 16 =
X(2) = (4 x
X(3) = (4 x
(b) X(0) = 35, A = 5
X(1) = (5 x 35 + 6) mod 16 =X(2) = (5 x
X(3) = (5 x
Generating the keytext Once the sequence X(1), X(2), X(3), …has beengenerated using PRNG (A, B, N), each decimalnumber X(k) is coded on log
N bits (= p, if N = 2
).
The resulting binary sequence is the keytext.
Maximum length of the keytext The maximum possible length of the sequence is: Æ
N decimal numbers, since it generates only numbers between 0 and N-1 (it will repeat after N hits at most) Æ
Max length = N * log
N binary numbers.
Back to Example 9
:
In part (b),the decimal sequence is:Since N=16, 4 bits will be used for each decimal,and the keytext is: Back to Example 9
:
In part (b), the maximum length is 16 x 4 = 64
2
2
p
Public-Key Implementation
Uses the mathematical function Modulo.C
mod N has very erratic behavior: as p increases,
C
increase, but C
mod N is not predictable.
and is not possible to reverse: if C, N are known, andK= C
mod N is known, it is not possible to find p.
It can be shown that[C
mod N]
mod N = [C
mod N]
mod N
= C
mod N
The process uses C
mod N as the key X(0), seed
for the PRNG seen previously (to form the keytext).
p
p
p
b
a
b
a
ab
ab
p
Public-Key Implementation
N, and C are public (known).
0 < C < N-
Alice and Bob have their own private key,a for Alice, and b for Bob (never communicated!)
Alice computesP = C
mod N
Alice sends Pto BobAlice receives Qfrom BobAlice computesK
= Q
mod N
(Æ
encrypt message)
a
a
a
Bob computesQ = C
mod N
Bob sends Qto AliceBob receives Pfrom AliceBob computesK
= P
mod N
(Æ
decrypt message)
b
b
b
K
= K
= X(0) is known to Alice and Bob only!
Even if P and Q are intercepted during theexchange, it is impossible to retrieve the keyX(0) without knowing either Alice or Bob’sprivate key (a or b).
a
b
Alice computesP = 5^ It is a secure process, but it is long, and requiressynchronization (exchange of P and Q).A better way is RSA: does not use XOR for theencryption, or decryption, but Modulo. The keyto decrypt is private and different from the oneto encrypt (public). RSA are the initials Rivest,Shamir, and Adleman (creators of the code).
mod 11 =
Alice sends Pto Bob, and receivesQ from BobAlice computesK
= Q
mod 11
=
2
2
2
Bob computesQ = 5
mod 11 =
Bob sends Qto Alice and receivesP from AliceBob computesK
= P
mod 11
=
4
4
4
Example 10
: (with small numbers to make it
computable by hand….)N = 11, C = 5 (notice 5 < 11)Alice’s private key: 2
Bob’s private key: 4
Alice will use K
=
to encrypt
Bob will use K
=
to decrypt
2 4
1 SOLUTIONS:
1
A Caesar shift was used to encrypt theFollowing sentence. Decrypt it. (hint: lookat double letters, and try possibilities)WH WG CDSBWBU KSSY TCF POGSPOZZ
It is opening week for baseball Encrypt the message below using theVigenere cipher and the keyword FRANCE.CANNOT WAIT FOR THE BREAK
2
2
HRNAQX BRIG HSW KHR DVJRK