Cryptographl Lect4
Cryptographl Lect4
Cryptographl Lect4
1
Stream Ciphers & Block Ciphers
stream ciphers in which the key stream is the repeated value of the key.
In other words, the key stream is considered as a predetermined stream
of keys or K = (k, k, …, k). In this cipher, however, each character in the
ciphertext depends only on the corresponding character in the plaintext,
because the key stream is generated independently.
The monoalphabetic substitution ciphers is stream ciphers. However,
each value of the key stream in this case is the mapping of the current
plaintext character to the corresponding ciphertext character in the
mapping table.
In a block cipher, a group of plaintext symbols of size m (m > 1) are
encrypted together creating a group of ciphertext of the same size.
Playfair ciphers are block ciphers. The size of the block is m = 2. Two
characters are encrypted together.
Affine Cipher
broaden to include multiplication
can define affine transformation as:
c = E(k, p) = (ap + b) mod (26)
p = D(k, c) = (a-1(c – b)) mod (26)
key k=(a,b)
a must be relatively prime to 26
so there exists unique inverse a-1
Affine Cipher
example
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
example: encrpt the message using affine k=(7,2):
Message = GO
Encrption = SW
E(G) =(7*6+2)mod26 =44 mod 26 =18 =S
E(O) =(7*14+2)mod 26 =98+2-100 mod 26 =22=w
Affine Cipher - Example
example k=(17,3):
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
= IN
D U L C T K B S J A R I Z Q H Y P G X O F W N E V M
= OUT
example:
meet me after the toga party
ZTTO ZT DKOTG OST OHBD YDGOV
Now how many keys are there?
12 x 26 = 312
Still can be brute force attacked!
Transposition ciphers(simply changes the order)
differ from the monoalphabetic ciphers (shift,
affine, and substitution)
In monoalphabetic ciphers, the letters are
changed by creating a new alphabet (the cipher
alphabet) and assigning new letters.
In transposition
ciphers, no new alphabet is created – the letters
of the plaintext are just rearranged is some
fashion.
Row Transposition Ciphers
is a more complex transposition
write letters of message out in rows over a
specified number of columns
then reorder the columns according to some
key before reading off the rows
Key: 4312567
Plain text attack post poned until twoam
Column Out 4 3 1 2 5 6 7
Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m x y z
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Simple Types of Transposition Ciphers
13
Brute Force Search
always possible to simply try every key •
most basic attack, proportional to key size •
assume either know / recognise plaintext •
14
Product Ciphers
ciphers using substitutions or transpositions are
not secure because of language characteristics
hence consider using several ciphers in
succession to make harder, but:
two substitutions make a more complex substitution
two transpositions make more complex transposition
but a substitution followed by a transposition makes a new
much harder cipher
this is bridge from classical to modern ciphers
Classical Substitution Ciphers
• where letters of plaintext are replaced by
other letters or by numbers or symbols
• or if plaintext is viewed as a sequence of bits,
then substitution involves replacing plaintext
bit patterns with ciphertext bit patterns
16
More Definitions
• unconditional security
– Ciphertext does not contain enough information to
determine uniquely the corresponding plaintext
– no matter how much time opponent has, or how much
Ciphertext is available.
• computational security
– given limited computing resources (eg time needed for
calculations is exceed the usefull lifetime of the
information), the cipher cannot be broken (or cost of
breaking the cipher exceeds the value of the encrypted
info.)
17
Steganography
Steganography is a method of hiding data in another
• media so that the data's very existence is concealed.
• an alternative to encryption
• hides existence of message
– using only a subset of letters/words in a longer message
marked in some way
– using invisible ink
– hiding in LSB in graphic image or sound file
• has drawbacks
– high overhead to hide relatively few info bits
18
ExE(2)
1-Affine Cipher
Encrypt the plaintext ‘how are you
if key = (5,7 )
2- Hill Cipher
Encrypt the plaintext : NETWORK
Key is 2 x 2 so we use
= Key
Row Transposition -2
,'WE ARE DISCOVERED. FLEE AT ONCE'
Key: 4312567