CS#3 - 1
CS#3 - 1
CS#3 - 1
Elias Debelo
Moyka Mosa
Haramaya Univesity
elias.debelo@haramaya.edu.et
moykad@gmail.com
1 Introduction
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 1 / 18
Introduction
Cryptography is a branch of mathematics based on the transformation
of data.
It provides an important tool for protecting information and is used in
many aspects of computer security.
Terminologies
1 An original message is known as the plaintext, while the coded
message is called the cipher text.
2 The process of converting from plaintext to cipher text is known as
enciphering or encryption; restoring the plaintext from the cipher text
is deciphering or decryption.
3 The many schemes used for encryption constitute the area of study
known as cryptography.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 3 / 18
Terminologies Cont.
1 Such a scheme is known as a cryptographic system or a cipher.
2 Techniques used for deciphering a message without any knowledge of
the enciphering details fall into the area of cryptanalysis.
Cryptanalysis is what the layperson calls “breaking the code.”
3 The areas of cryptography and cryptanalysis together are called
cryptology.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 4 / 18
Cryptographic systems
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 5 / 18
The number of keys used. If both sender and receiver use the same
key, the system is referred to as symmetric, single-key, secret-key, or
conventional encryption. If the sender and receiver use different keys,
the system is referred to as asymmetric, two-key, or publickey
encryption.
The way in which the plaintext is processed. A block cipher processes
the input one block of elements at a time, producing an output block
for each input block. A stream cipher processes the input elements
continuously, producing output one element at a time,as it goes along.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 6 / 18
Private key encryption
(Secret Key)
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 7 / 18
Symmetric Cipher Model
A symmetric encryption scheme has five ingredients.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 8 / 18
Symmetric encryption Cont.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 9 / 18
Symmetric encryption Cont.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 10 / 18
Substitution Techniques
A substitution technique is one in which the letters of plaintext are
replaced by other letters or by numbers or symbols.
It is a classical encryption techniques.
Caesar Cipher
The earliest known, and the simplest, use of a substitution cipher was by
Julius Caesar. The Caesar cipher involves replacing each letter of the
alphabet with the letter standing three places further down the alphabet.
Note that the alphabet is wrapped around, so that the letter following Z is A.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 11 / 18
Caesar Cipher
For each plain-text letter P, substitute the cipher text letter C.
C = E (3, p) = (p + 3) mod 26
A shift may be of any amount, so that the general Caesar algorithm is:
C= E (k, p) = (p + k) mod 26
Where takes on a value in the range 1 to 25. The decryption algorithm is
simply
p = D (k, C) = (C - k) mod 26
Practice
1 Encrypt ’Hello’ message using Caesar cipher of key = 3
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 12 / 18
Symmetric Block Encryption Algorithms
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 13 / 18
Data Encryption Standard (DES)
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 14 / 18
A block cipher processes the input one block of elements at a time,
producing an output block for each input block.
The key in DES is 56 bits; 8-bit out of the total 64-bit block key is
used for parity check (for example, if odd parity is used, each byte has
an odd number of bits.
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 15 / 18
DES Phases
1 Phase 1
The 64-bit plaintext passes through an initial permutation (IP) that
rearranges the bits to produce the permuted input; no elements are
added or deleted or replaced, rather the order in which the elements
appear in the sequence is changed
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 16 / 18
1 Phase 2
1 The 64 bits are then divided into two 32-bit halves called L and R. The
encryption then proceeds through 16 rounds of the same function, each
using the L and R parts, and a subkey
2 In each round, the new L part is simply a copy of the incoming R part.
3 The R and subkeys are processed in the so called f-function, and
exclusive-or of the output of the f-function with the existing L part to
create the new R part.
4 item
2 Phase 3
The preoutput is passed through a permutation that is the inverse of
the initial permutation (IP-1), to produce the 64-bit ciphertext
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 17 / 18
Structure of DES
Elias Debelo Moyka Mosa (HU) Computer Science January 13, 2021 18 / 18