Professional Documents
Culture Documents
Abey B. (MSc.)
What is Cryptography?
The word Cryptography comes from the Greek words krypto
’hidden’ and grapho ’writing’.
I Therefore, we can say that cryptography is the science of secret, or
hidden writing
Cryptography: is “the science of coding and decoding messages so
as to keep these messages secure”.
Today, many common IT tools use embedded encryption
technologies to protect sensitive information within applications
I All the popular Web browsers use built-in encryption features to enable
secure e-commerce, such as online banking and web shopping
Basic Terminologies
Algorithm: The programmatic steps used to convert a plaintext into
an encrypted sequence of bits that represent the message
Plaintext: The original form of a message
Ciphertext: - The coded/encrypted form of a message
Key: info used in cipher known only by the sender/receiver
I The key which is an input to the algorithm is secret
I Key is a string of numbers or characters
I If same key is used for encryption & decryption the algorithm is
called symmetric
I If different keys are used for encryption & decryption the algorithm
is called asymmetric
Basic Terminologies
Encipher (encrypt): the process of converting plaintext to ciphertext
Decipher (decrypt): recovering plaintext from ciphertext
Cryptography: the study of encryption principles/methods
Cryptanalysis (codebreaking): the study of principles/ methods of
breaking ciphertext without knowing key
Cryptology: the field of both cryptography and cryptoanalysis
Cipher classification
Caesar Cipher
Earliest known substitution cipher
Replaces each letter by 3rd letter on
Example:
What is the plaintext if the ciphertext is: KRZ DUH BRX GRLQJ
With a caesar cipher, there are only 26 possible keys, of which only
25 are of any use
I Since mapping A to A etc doesn’t really obscure the message!
Example 1
Use the Caesar cipher with shift of 3 to encrypt the message: “We
ride at noon”
Solution
We use the mapping above to replace each letter. W gets replaced
with Z, and so forth, giving the encrypted message: ZH ULGH DW
QRRQ.
Example 2
Decrypt the message GZD KNK YDX MFW JXA if it was encrypted
using a shift cipher with shift of 5.
Caesar Cipher
Define transformation as:
Monoalphabetic Cipher
Problem is language characteristics
I Human languages are redundant
I Letters are not equally commonly used
English letter frequencies
Polyalphabetic Cipher
An advanced substitution cipher using two or more alphabets
In polyalphabetic substitutions
I The plaintext of each letter is transformed into its corresponding letters
based on its order of appearance in the plaintext and the sets of
substitution cipher
Note: Each substitution steps use Caesar Cipher substitution
Example:
I Plaintext: ABCDEFGHIJKLMNOPQRSTUVWXYZ
I Substitution cipher 1: DEFGHIJKLMNOPQRSTUVWXYZABC
I Substitution cipher 2: GHIJKLMNOPQRSTUVWXYZABCDEF
I Substitution cipher 3: JKLMNOPQRSTUVWXYZABCDEFGHI
I Substitution cipher 4: MNOPQRSTUVWXYZABCDEFGHIJKL
Find the ciphertext if the plaintext is TEXT?
Polyalphabetic Cipher
To encode the plaintext TEXT with the given ciphers
1 Substitute the first letter of the plaintext by its corresponding letter
from cipher1; T to W
2 Substitute the second letter of the plaintext by its corresponding letter
from cipher2; E to K
3 Substitute the third letter of the plaintext by its corresponding letter
from cipher3; X to G
4 Substitute the fourth letter of the plaintext by its corresponding letter
from cipher4; T to W
The ciphertext is then WKGF
Transposition Cipher
Transposition cipher relies on an algorithm which rearranges the
order of the letters in a plaintext message
In a columnar transposition, a plaintext message is transposed into
several columns
Ciphertext is produced by reading the resulting rows in sequence
Example with 2 columns:
Plaintext: SECRET
Solution
I SE
CR
ET
Ciphertext: SCEERT
Class Work
1 Plaintext: THIS IS A MESSAGE TO SHOW HOW A
COLUMNAR TRANSPOSITION WORKS.
Key: We arrange the letters in five columns
2 Find the plaintext if the ciphertext is GARNODFENOBYOTOO if
the depth or key is 3
TSSOHOANIWHAASOLRSTOIMGHWUTPIRSEEOAMROOKIST
WCNASNS
Lecture 02 Basic Cryptography July 29, 2022 21 / 52
Classical Symmetric Cryptography
Transposition Cipher
Plaintext : Geeks for Geeks
Key:HACK
In a transposition cipher, the order of the alphabets is re-arranged to
obtain the cipher-text.
To get Plaintext into Ciphertext follow the following step:
Encryption
1 The message is written out in rows of a fixed length, and then read
out again column by column, and the columns are chosen in some
scrambled order.
2 Width of the rows and the permutation of the columns are usually
defined by a keyword.
3 For example, the word HACK is of length 4 (so the rows are of length
4), and the permutation is defined by the alphabetical order of the
letters in the keyword. In this case, the order would be “3 1 2 4”.
4 Finally, the message is read off in columns, in the order specified by
the keyword.
Transposition Cipher
Example:
I Plain text: Attack Postponed Until Two AM
I Key: 3 4 2 1 5 6 7 7x4
Rail-Fece Transposition
In rail-fence transposition,is plaintext is written down as sequence
of diagonals and then read off as sequence of row.
Example
For example, to encipher the message “MEET ME AFTER THE
GOOD PARTY” with a rail fence of depth 3 (number of rows,
which is the key), we write the following
Stream Ciphers
Stream ciphers commonly work as follows:
I Encrypt data one bit or one byte at a time
I A single character of plaintext is combined with a single character from
a key stream to produce a single character of ciphertext
I The ciphertext character from step 1 is sent to the receiver
I Steps 1 and 2 are repeated until the entire message has been sent
I Examples of Stream Ciphers
1 Salsa20 (software and hardware implementations),
2 ChaCha20 (the modified version of Salsa20)
3 RC4 (for wireless networks)
4 A5 (for GSM cellular networks)
Block ciphers
In block cipher, a group of plaintext characters of a fixed size (a
block) is encrypted at once and sent to the receiver
I The process is repeated until the entire plaintext message has been sent
The number of bits in block is fixed
Examples of Block Ciphers:
1 Data Encryption Standard (DES)
2 Triple DES (3DES or TDEA)
3 Advanced Encryption Standard (AES)
4 International Data Encryption Algorithm (IDEA)
Given:
I Everybody knows Bob’s public key
I Only Bob knows the corresponding private key
Goals:
I Alice wants to send a message that only Bob can read
I Bob wants to send a message that only Bob could have written
Applications:
I Encryption for confidentiality
F Anyone can encrypt a message
F With symmetric crypto, must know the secret key to encrypt
I Only someone who knows the private key can decrypt
F Secret keys are only stored in one place
Requirements
RSA
Developed by Ron Rivest, Adi Shamir, Len Adelman
Most popular public key algorithm
Variable Key Size (512, 1024, or 2048 bits)
RSA Example 1
Encrypt the word love using RSA Algorithm
Solution
1 P=5 & q=7
2 n=5*7=35 and z=(4)*(6) = 24
3 e=5
4 d = 29 , (29x5 –1) is exactly divisible by 24
5 Keys generated are
F Public key: (35,5)
F Private key is (35, 29)
RSA Example 1
Decrypt the word qovj using (m = cd mod n)
n = 35, d=29
RSA Example 2
Encrypt plaintext 9 using the RSA public-key encryption algorithm.
Uses prime numbers 7 and 11 to generate the public and private keys.
Home WORK
In an RSA cryptosystem, a particular A uses two prime numbers, 13
and 17, to generate the public and private keys. If the public of A is
35. Then the private key of A is . . . . . . . . . . . . . . . ?
Question
Many Thanks!