Cryptography
Cryptography
Cryptography
Definition of Terms
Cryptography is the science of using mathematics to encrypt and decrypt data.
Cryptography enables you to store sensitive information or transmit it across
insecure networks so that it cannot be read by anyone except the intended
recipient.
Plaintext is the original message or original data that needs to be encrypted.
Ciphertext is the encrypted message or output message which is produced as
output. It mainly depends on plaintext and secret key.
Encryption Algorithm is an algorithm which transforms and substitutes the
plaintext into ciphertext.
Decryption is the process of converting from ciphertext to plain text is called as
decryption or deciphering.
Basic Cryptography
I. Subtitution Cipher - each letter is replaced with a letter some fixed number of
positions in the alphabet
Shifted Alphabet Code / Ceasar Cipher - each letter is replaced with a letter
some fixed number of positions in the alphabet
Example 1: Use the Caesar cipher with shift of 3 to encrypt the message: DURA
LEX SED LEX.
Mapping:
Image Credit:https://en.wikipedia.org/wiki/Caesar_cipher
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
X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Example 3: Use the Caesar cipher with shift of 15 to encrypt the message:
PERICARDITIS.
Original Message: PERICARDITIS
Encrypted Message: ETGX RPGS XIXH
Example 4: Decrypt the message below if it was encrypted using a shift cipher
with shift 20.
Encrypted Message: QIL EMG ULN HIN QIL EBU LXU
Original Message: WOR KSM ART NOT WOR KHA RDA
Original Message: WORK SMART NOT WORK HARD
Alberti cipher disk (1400s)
In a cipher disk, the inner wheel could be turned to
change the cipher shift. The larger one is called Stabilis
(stationary or fixed), the smaller one is called Mobilis
(movable).
Encryption Security
• In the case of a shift cipher, the method is “a shift cipher is used”. The
encryption key is the “specific amount of shift” used.
• The security of any encryption method should depend only on the
encryption key being difficult to discover. It is not safe to rely on the
encryption method (algorithm) being kept secret.
• The alphabetical shift cipher has 25 encryption keys.
• The alphanumeric shift cipher has 35 encryption keys.
What is the obscured message from the cipher text: PECTORAL MUSCLES
using alphanumerical shift cipher with shift 8?
Original Message: PECTORAL MUSCLES
Encrypted Message: XMK1WZIT U20KTM0
Brute Force Attack – a method for breaking encryption by trying all encryption
keys.
Example 6: Suppose you intercept a message, and you know the sender is using
a Caesar cipher, but do not know the shift being used. The messages begins
EQZP. What is the message?
II. Transposition Cipher -the letters are rearranged according to some
predetermined rule or key.
Example 1: Encryption
Encrypt the message :MEET ME AT THE SECRET LOCATION using rows of 8
characters each.
Step 1. Write the message in rows of 8 characters each. Nonsense characters
are added to the end to complete the last row.
M E E T M E A T
T H E S E C R E
T L O C A T I O
N X X X X X X X
Step 2. Encrypt the message by recording down the columns. For example, the
first column reading down would be MTTN.
MTTN EHLX EEOX TSCX MEAX ECTX ARIX TEOX
Note: The spaces will be removed or repositioned to hide the size of the table used
since it is the encryption key used to hide the message.
Example 2: Decryption
Decrypt the message : CAIN FONN TAMD EECM LIRE with rows of 4
characters.
Step 1. Determine the number of rows by getting the qoutient of the number of
characters and number of character per row. Then construct a table with 5 rows
and 4 columns.
20/4 = 5 rows
Step 2. Start writing by putting the first 5 letters , CAINF, down the first column.
C O M M
A N D L
I N E I
N T E R
F A C E
H E A R T
3 2 1 4 5
H I G H B
L O O D P
R E S S U
R E X X X
H E A L T H
3 2 1 5 6 4
Step 3. Write down the message down the columns using the order of letters in
the keyword.
a. Fill out column #1.
H E A L T H
3 2 1 5 6 4
X
b. Fill out column #2.
H E A L T H
3 2 1 5 6 4
R T
L H
T E
N X
H E A L T H
3 2 1 5 6 4
A R T E R I
A L H Y P E
R T E N S I
O N X X X X
Step 4. To decrypt the message , read across the rows . Remove the non-
significant characters.
Original Message: ARTERIAL HYPERTENSION