Title: CMPE 471
1CMPE 471
- BASIC ENCRYPTION AND DECRYPTION
2TERMINOLOGY BACKGROUND
- Suppose S (Sender) wants to send a message to R
(Reciever). S entrusts the message to T, who will
deliver it to R T then becomes the transmission
medium. If an outsider, O, wants the message and
tries to access it, we will call O an interceptor
or intruder.
3TERMINOLOGY BACKGROUND
- Any time after S transmits via T, the message is
exposed, so O might try to access the message - Block it, by preventing it to reach to R
availability - Intercept it, by reading or listening to the
message secrecy - Modify it, by seizing the message and changing
it integrity - Fabricate an authentic looking message, arranging
as if it came from S integrity.
4TERMINOLOGY BACKGROUND
- Encryption (encode/ encipher)
- Process of encoding a message so that its meaning
is not so obvious. - Decryption (decode/ decipher)
- Is the reverse process transforming an encrypted
message back into its normal form. - Cryptosystem
- A system for encryption and decryption
- Plaintext
- The original form of the message
- Ciphertext
- The encrypted form of the message.
5TERMINOLOGY BACKGROUND
- Encryption Algorithms
- Some encryption algorithms use a key K, so that
the ciphertext message depends on both the
original plaintext message and the key value - C E(K,P)
- E is a set of encryption algorithms, and the key
K selects one specific algorithm. - Sometimes the encryption and decryption keys are
the same P D(K, E(K,P)). This is called
symmetric encryption since D and E are
mirror-image processes. - Other times encryption and decryption keys come
in pairs. Then a decryption key K inverts the
encryption of key K so that P D(K , E(K
,P)). Encryption algorithms of this form are
called asymmetric, because converting C back to P
is not just reversing the steps of E.
D
E
D
E
6ENCRYPTION ALGORITHMS
Original Plaintext
Plaintext
Ciphertext
Decryption
Encryption
ENCRYPTION
7ENCRYPTION ALGORITHMS
Key
Original Plaintext
Plaintext
Ciphertext
Encryption
Decryption
Symmetric Cryptosystem
Encryption Key K
Encryption Key K
E
D
Original Plaintext
Plaintext
Ciphertext
Encryption
Decryption
Asymmetric Cryptosystem
8ENCRYPTION ALGORITHMS
- Cryptograpghy
- Hidden writing, the practice of using encryption
to conceal text. - Cryptanalyst
- Studies encryption and encrypted messages, with
the goal of finding the hidden meanings of the
messages. - Cryptology
- Is the research into and study of encryption and
decryption it includes both cryptography and
cryptanalysis.
9ENCRYPTION ALGORITHMS
- Substitution
- One letter is exchanged for another
- Transposition
- The order of the letters is rearranged
10MONOALPHABETIC CIPHERS (SUBSTITUTIONS)
- The Caesar Cipher
- Named after Julius Caeser. Each letter is
translated to the letter a fixed number of
letters after it in the alphabet. Caesar used to
shift 3, so that plaintext letter p was
enciphered as ciphertext letter c by the rule - c E(p ) p 3
- Plaintext A B C D E F G H I J K L M N O P
Q R S T U V W Y Z - Chiphertext d e f g h i j k l m n o p
q r s t u v w y z a b c
i
i
i
i
i
11MONOALPHABETIC CIPHERS (SUBSTITUTIONS)
- Using this encryption encode the below message
- TREATY IMPOSSIBLE
- Would be encoded as
- TREATY IMPOSSIBLE
- wu hd wb l p s r vv le o h
12MONOALPHABETIC CIPHERS (SUBSTITUTIONS)
- The pattern p 3 is easy to memorise and it is
a simple cipher. - That obvious pattern is also the major weakness
of the Ceasar cipher. - A secure encryption should not allow an
interceptor to use a little piece to predict the
entire pattern of the encryption.
i
13EXERCISE I
- Please decipher the following
-
- dh ey vdedk duded wdpluflvlqh jlwwlp vrqud
eludc jhcphbh jlwwlp zh rnyod jhoglp
eyudgd ghuvlp zdu
14ANSWER
- ben bu sabah araba tamircisine gittim sonra
biraz gezmeye gittim ve okula geldim burada
dersim var
15EXERCISE II
- Please make the cryptanalysis of Caesar chipher.
16ANSWER
- Suppose you were trying to break the following
ciphertext message - Wklv phvvdjh lv qrw wrr kdug wr euhdn
- The message has been enciphered with a 27-symbol
alphabet - Worst of all the blank has been translated to
itself - It shows which are the small words
- In encryption spaces between words often are
deleted under the assumption that a legitimate
reciever can breakmostmessagesintowordsfairlyeasil
y.
17ANSWER
- English has relatively few small words such as
am, is, to, be, he, we, and, are, you, she... - One attack is to substitute known short words at
appropriate places in the ciphertext and try to
substituting for matching characters other places
in the ciphertext. - A stronger clue is the repeated R in the word
wrr see, too, add, odd, off
18ANSWER
- The cryptanalysis here is ad hoc
- Uses deduction based on guesses instead of solid
principles. - Another approach is to consider which letters
commonly start words, which letters commonly end
words, and which prefixes and suffixes are common.
19Polyalphabetic Substitution Ciphers
- The weakness of monoalphabetic ciphers is that
their frequency distribution reflects the
distribution of the underlying alphabet. - A cipher that is more cryptographicaly secure
would display a rather flat distribution, which
gives no information to cryptanalyst. - One way to flatten the distribution is to combine
distributions that are high with ones that are
low - If T is enciphered as a and b, and if X is also
enciphered as a and b, the high frequency of T
mixes with the low frequency of X to produce a
more moderate distribution for a and b.
20Polyalphabetic Substitution Ciphers
- We can combine two distributions by using two
separate encryption alphabets - All charaters in odd positions of the plaintext
message - All characters in even positions
- 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 - a d g j m p s v y b e h k n q t w z
c f i l o r u x - 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 - n s x c h m r w b g l q v a f k p u z
e j o t y d i
Table for odd positions
Table for even positions
21Polyalphabetic Substitution Ciphers
- The first table uses the permutation
- ?i(?) (3?) mod 26
- The second uses the permutation
- ?2(?) ((5?) 13) mod 26
- Encryption with these tables would be
- TREATY IMPOSSIBLE
- TREAT YIMPO SSIBL E
-
- f u m nf dyvtf czysh h
22Polyalphabetic Substitution Ciphers
- Notice that the double S becomes cz and that the
two Es are enciphered as m and h - Polyalphabetic encryption flattens the frequency
distribution of the plaintext considerably.
23EXERCISE 3
- Please make the cryptanalysis of polyalphabetic
substitutions
24ANSWER
- With a little help from frequency distributions
and letter patterns you can break monoalphabetic
substitution by hand - With the aid of computer programs and with an
adequate amount of ciphertext, a good
cryptanalyst can break such a cipher in an hour. - In some applications the prospect of one days
effort may not make sense and it may be enough to
protect the message. - There are two tools that can decrypt messages
written even with a large number of alphabets - The Kasiski method for repeated patterns the
method relies on the regularity of English. If a
message is encoded with n alphabets in cyclic
rotation, and if a particular word or letter
group apperas k times in a plaintext message, it
should be encoded approximately k/n times from
the same alphabet. - Index of Coincidence to rate how well a
particular distribution matches the distribution
of letters in English. The index of coincidence
is a measure of the variation between frequencies
in a distribution.
25Summary of Substitutions
- Substitutions are effective cryptographic devices
used in diplomatic communications and appeared in
the mysteries of - Arthur Conan Doyle, Allan Poe, Agatha Cristie...
- The presentation of substitution ciphers has also
introduced several cryptoanalytic tools - Frequency distribution
- Index of coincidence
- Consideration of highly likely letters and
probable words - Repeated pattern analysis and the Kasiski
approach - Persistence, organisation, ingenuity, and luck
26Transpositions (Permutations)
- The goal of substitution is confusion, an attempt
to make it difficult to determine how a message
and key were transformed into ciphertext. - A transposition is an encryption in which the
letters of the message are rearranged. - The goal is diffusion, spreading the information
from the message or the key out widely across the
ciphertext permutation.
27Transpositions (Permutations)
Plaintext message
five-column transposition
Ciphertext is formed by traversing the columns
28Transpositions (Permutations)
- The resulting ciphertext would then be read as
- tssoh oaniw haaso lrsto imghw
- utpir seeoa mrook istwc nasns
- The length of this message happened to be a
multiple of five, so all columns came out the
same length - If the message length is not a multiple of the
length of a row, the last columns will be a
letter short.
29Transpositions (Permutations)
- Encipherment/ Decipherment Complexity
- Involves no additional work beyond arranging the
letters and reading them off again. - The algorithm is constant in the amount of work
per character, and the time for the algorithm is
proportional to the length of the message - This algorithm requires storage for all
characters of the message, so the space required
is not constant but depends directly on the
length of the message. - Because of the storage space and the delay
involved, it is not appropriate for long messages.
30Transpositions (Permutations)
- Diagrams
- Characteristic patterns of pairs of adjacent
letters. - Such as re, -th, -en, -ed, -on, -in, -an...
- Trigrams
- Groups of three letters in English
- Such as ent, -ion, -ing, -ive, -for, -one...
31EXERCISE 4
- Please make the cryptanalysis of transpositions
32ANSWER
- The basic attack on columnar transpositions is
not as precise as the attack on substitution
ciphers. - Transpositions look less secure since they leave
the plaintext letters intact, the work for
cryptanalyst is more exhausting, because it
relies on a human judgement of what looks
right. - The process involves exhaustive comparison of
strings of ciphertext. - Compares a block of ciphertext characters against
characters successively farther away in the
ciphertext.
33Fractionated Morse
- Morse Code
- Means of representing letters as sequences of
dots and dashes, used with telegraphs, and
flashing lights.
34Stream Ciphers
- They convert one symbol of plaintext immediately
into a symbol of ciphertext (columnar
transposition is the exception). - The transformation depends only on the symbol,
the key, and control information of the
encipherment algorithm.
Key (Optional)
Stream Encryption
Y
wdhuw...
ISSOPMI
Plaintext
Ciphertext
Encryption
35Stream Ciphers
- Advantages
- Speed of transformation each symbol is encrypted
without regard for any other plaintext symbols,
each symbol can be encrypted as soon as it is
read. Thus the time to encrypt each symbol
depends only on the encryption algorithm itself,
not on the time it takes to receive more
plaintext. - Low error propogation since each symbol is
separately encoded, an error in the encryption
process affects only that character.
36Stream Ciphers
- Disadvantages
- Low diffusioneach symbol is separately
enciphered. Therefore, all the information of
that symbol is contained in one symbol of the
ciphertext. A cryptanalyst can attempt to break
it by analaysing the characteristics of all
individual symbols of the ciphertext, using tools
such as frequency distribution counts, Kasiski
method, etc. - Susceptibility to malicious insertions and
modifications because each symbol is separately
encipherde, an active interceptor who has broken
the code can splice together pieces of previous
messages and transmit a spurious new message that
may look authentic.
37Block Ciphers
- Encrypt a group of plaintext symbols as one
block. - Columnar transpositions and other transpositions
are examples of block ciphers.
Key (Optional)
XN OI TP YR CN ES
Block Cipher Systems
IH
po
Plaintext
Ciphertext
ba qc kd em mc
Encryption
38Block Ciphers
- Advantages
- Diffusion information from plaintext is diffused
into several ciphertext symbols. One ciphertext
block may depend on several plaintext letters. - Immunity to insertions because blocks of symbols
are enciphered, it is impossible to insert a
single symbol into one block. The length of the
block would then be incorrect, and the
decipherment would quickly reveal the insertion.
39Block Ciphers
- Disadvantages
- Slowness of encryption block ciphers must wait
until an entire block of plaintext symbols has
been received before starting the encryption
process. - Error propagation an error will affect the
transformation of all characters in the same
block.
40Good Ciphers
- Shannon Characteristics
- The amount of secrecy needed should determine the
amount of labour appropriate for the encryption
and decryption - The set of keys and the enciphering algorithm
should be free from complexity - The implementation of the process should be as
simple as possible - Errors in ciphering should not propogate and
cause corruption of further information in the
message - The size of the enciphered text should be no
longer than the text of the original message.