0% found this document useful (0 votes)
3 views

computer security

The document provides an overview of cryptography, focusing on the Advanced Encryption Standard (AES) algorithm. It explains the process of encryption and decryption using AES, detailing its structure, including the steps of SubBytes, ShiftRows, MixColumns, and Add Round Key. Additionally, it discusses the significance of various cryptographic algorithms and their applications in securing data transmission and storage.

Uploaded by

Ibrahim Miah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

computer security

The document provides an overview of cryptography, focusing on the Advanced Encryption Standard (AES) algorithm. It explains the process of encryption and decryption using AES, detailing its structure, including the steps of SubBytes, ShiftRows, MixColumns, and Add Round Key. Additionally, it discusses the significance of various cryptographic algorithms and their applications in securing data transmission and storage.

Uploaded by

Ibrahim Miah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Computer

Security
L EC T U RER: S HEB I K A RAN I
L EC T U RE: C RY PTOG RAPHI C ALG ORI T HM( AES )
What is Cryptography?
Cryptography is a process of hiding transmitted information by the sender such that it may be read
only by the intended recipient. Cryptography is widely used in various fields such as end-to-end
messaging, banking and finance, secure web communication, and access control.
What are Cryptographic Algorithms?

A cryptographic algorithm is a set of steps that can be used to convert plain text into cipher text. A
cryptographic algorithm is also known as an encryption algorithm.

A cryptographic algorithm uses an encryption key to hide the information and convert it into an
unreadable format. Similarly, a decryption key can be used to convert it back into plain-readable text.
Types of Cryptographic Algorithms

To protect sensitive data and conversations, cryptography uses complex algorithms. These
mathematical formulas enable the encryption, decryption, signature, and verification processes that
protect secret data during transmission and storage.
There are various types of cryptographic algorithms but in this article we will be discussing the 4
major types of cryptographic algorithms.
1. Advanced Encryption Standard (AES)
2. Data Encryption Standard (DES)
3. RSA Algorithm (Rivest, Shamir, Adleman Algorithm)
4. Secure Hash Algorithm (SHA)
Advanced Encryption Standard (AES)

AES (Advanced Encryption Standard) is a popular encryption algorithm which uses the same key for
encryption and decryption It is a symmetric block cipher algorithm with block size of 128 bits, 192 bits
or 256 bits.

There are many types of AES depending on the rounds:

•AES-128 uses 10 rounds

•AES-192 uses 12 rounds

•AES-256 uses 14 rounds


Advanced Encryption Standard (AES)

The more rounds there are, the safer the encryption. This is why AES-256 is considered the safest
encryption.(1 word=32bits)
Advanced Encryption Standard (AES)

Pre-round Transformation: X-OR operation performed here.

Numbers of keys generated by Key Expansion algorithm= (number of round+1)

Some necessary information to know:

Bits 0 or 1 State:

1 byte -> group of 8 bits 16 bytes(4*4)

1 word-> 4 byte-> 32 bits states stores intermediate results.

Block size= 128 bits


Advanced Encryption Standard (AES)

Input Array (4*4 is 16 bytes is 128 bits or 4 words)

w0 w1 w2 w3
Advanced Encryption Standard (AES)

Encryption

AES considers each block as a 16-byte (4 byte x 4 byte = 128 ) grid in a column-major arrangement.
Advanced Encryption Standard (AES)

Each round comprises of 4 steps :

• SubBytes

• ShiftRows

• MixColumns

• Add Round Key

The last round doesn’t have the MixColumns round.

The SubBytes does the substitution and ShiftRows and MixColumns perform the permutation in the algorithm.
Advanced Encryption Standard (AES)

Sub Bytes:

This step implements the substitution.

In this step, each byte is substituted by another byte. It is performed using a lookup table also called
the S-box. This substitution is done in a way that a byte is never substituted by itself and also not
substituted by another byte which is a compliment of the current byte. The result of this step is a 16-
byte (4 x 4 ) matrix like before.

The next two steps implement the permutation.


Advanced Encryption Standard (AES)

Shift Rows

This step is just as it sounds. Each row is shifted a particular number of times.

•The first row is not shifted

•The second row is shifted once to the left.

•The third row is shifted twice to the left.

•The fourth row is shifted thrice to the left.


Advanced Encryption Standard (AES)
Advanced Encryption Standard (AES)

Mix Columns

This step is a matrix multiplication. Each column is multiplied with a specific matrix and thus the
position of each byte in the column is changed as a result.

This step is skipped in the last round.


Advanced Encryption Standard (AES)

Add Round Keys

Now the resultant output of the previous stage is XOR-ed with the corresponding round key. Here, the
16 bytes are not considered as a grid but just as 128 bits of data.

After all these rounds 128 bits of encrypted data are given back as output. This process is repeated
until all the data to be encrypted undergoes this process.
AES Sub bytes
It is also known as forward substitute bytes transformation.

AES defines a 16*16 matrix of byte values, called an S-box, that contains a permutation of all
possible 256 8-bit values.

These row and column values serve as index into S-box to select a unique 8-bit output value.
AES Sub bytes
Let’s take an example: Row E

State: EA 87
EA 04 65 85 87 F2 4D 97
83 45 5D 96 Column A EC 6E 4C 90
5C 33 98 B0 4A C3 46 E7
F0 2D AD C5 8C D8 95 A6

State array
AES Shift Rows
It is also called as forward shift row transformation.

State Array= output of substitute bytes Rules of Shifting.

Row 1-> No Shifting

Row 2-> 1 byte circular left shift

Row 3-> 2 byte circular left shift

Row 4-> 3 byte circular left shift


AES Shift Rows
87 F2 4D 97 87 F2 4D 97
EC 6E 4C 90 6E 4C 90 EC
4A C3 46 E7 46 E7 4A C3
8C D8 95 A6 A6 8C D8 95
AES Mix Column
Third transformation function of AES is called as Mix Columns, operates on each column
individually.

2 3 1 1 87 F2 4D 97
1 2 3 1 * 6E 4C 90 EC ->
1 1 2 3 46 E7 4A C3
3 1 1 2 A6 8C D8 95

Predefine matrix State Array New State Array


AES Mix Column
State Array -> The output of Shift rows function.

Rules:

First row of the predefine Matrix(*) First Column of State Array.

2 3 1 1 87 F2 4D 97
1 2 3 1 6E 4C 90 EC
1 1 2 3 46 E7 4A C3
3 1 1 2 A6 8C D8 95
AES Mix Column
{2}*{87}(+){3}*{6E}(+){1}*{46}(+){1}*{A6}

1. We need to convert the hexadecimal data into Binary First:

2= 0000 0010

87= 1000 0111

2.Need to apply Polynomial Theorem-> GF(2^3)

X^7+X^6+X^5+X^4+X^3+X^2+X^1+X^0
AES Mix Column
For 02:

X^7+X^6+X^5+X^4+X^3+X^2+X^1+X^0

0 0 0 0 0 0 1 0 X

For 87:

X^7+X^6+X^5+X^4+X^3+X^2+X^1+X^0 X^7+X^2+X^1+1

1 0 0 0 0 1 1 1
AES Mix Column
Now Multiply the values:

{02}*{87}= X*{X^7+X^2+X^1+1}

=X^8+X^3+X^2+X

= X^4+ X^3+X+1+X^3+X^2+X

= X^4+X^2+1

X^7+X^6+X^5+X^4+X^3+X^2+X^1+X^0

0 0 0 1 0 1 0 1

So, {2}*{87}= 0001 0101


AES Mix Column
Follow the Same Process and Find out all the Values:

3= 0000 0011

6E=0110 1110

X^7+X^6+X^5+X^4+X^3+X^2+X^1+X^0

0 0 0 0 0 0 1 1 (X+1)

X^7+X^6+X^5+X^4+X^3+X^2+X^1+X^0

0 1 1 0 1 1 1 0 (X^6+X^5+X^3+X^2+X)
AES Mix Column
{03}*{6E}= (X+1) * (X^6+X^5+X^3+X^2+X)

= X^7+X^6+X^4+X^3+X^2+X^6+X^5+X^3+X^2+X

= X^7+ X^5+ X^4+ X

X^7+X^6+X^5+X^4+X^3+X^2+X^1+X^0

1 0 1 1 0 0 1 0

{3}*{E6}= 1011 0010


AES Mix Column
Follow the previous rules:

{1}*{46} = 0100 0110

{01}*{A6}= 1010 0110

Now X-OR operation:

{2}*{87}= 0001 0101

{3}*{6E}= 1011 0010

{1}*{46}= 0100 0110

{1}*{A6}= 1010 0110

X-OR = 0100 0111 -> 47


AES Mix Column
Third transformation function of AES is called as Mix Columns, operates on each column
individually.

2 3 1 1 87 F2 4D 97 47
1 2 3 1 * 6E 4C 90 EC ->
1 1 2 3 46 E7 4A C3
3 1 1 2 A6 8C D8 95

Predefine matrix State Array New State Array


AES Mix Column
State Array -> The output of Shift rows function.

Rules:

2nd row of the predefine Matrix(*) First Column of State Array.

2 3 1 1 87 F2 4D 97
1 2 3 1 6E 4C 90 EC
1 1 2 3 46 E7 4A C3
3 1 1 2 A6 8C D8 95
AES Mix Column
2nd row and First column operation:

{1}*{87}= 1000 0111

{2}*{6E}= 1101 1100

{3}*{46}= 1100 1010

{1}*{A6}= 1010 0110

X-OR = 0011 0111 -> 37


AES Mix Column
3rd row and First column operation:

{1}*{87}= 1000 0111

{1}*{6E}= 0110 1110

{2}*{46}= 1000 1100

{3}*{A6}= 1111 0001

X-OR = 1001 0100 -> 94


AES Mix Column
4th row and First column operation:

{3}*{87}= 1001 0010

{1}*{6E}= 0110 1110

{1}*{46}= 0100 0110

{2}*{A6}= 0101 0111

X-OR = 1110 1101 -> ED


AES Mix Column
Next Steps will be: (for new State Array’s 2nd column)

1st row and 2nd column operation

2nd row and 2nd column operation

3rd row and 2nd column operation

4th row and 2nd column operation


AES Mix Column
for new State Array’s 3rd column:

1st row and 3rd column operation

2nd row and 3rd column operation

3rd row and 3rd column operation

4th row and 3rd column operation


AES Mix Column
for new State Array’s 4th column

1st row and 4th column operation

2nd row and 4th column operation

3rd row and 4th column operation

4th row and 4th column operation


AES Mix Column
New Statement Array:

47 40 A3 4C
37 D4 70 9F
94 E4 3A 42
ED A5 A6 BC
AES Add Round Key
Fourth Transformation function of AES is called as Add Round Key.

It is also known as forward add round key transformation.

The 128 bits of State are bitwise X-OR with the 128 bits of the round key.

Add Round key proceeds one column at a time.


AES Add Round Key
47 40 A3 4C 87 F2 4D 97
* ->
37 D4 70 9F 6E 4C 90 EC
94 E4 3A 42 46 E7 4A C3
ED A5 A6 BC A6 8C D8 95

State Array Round Key New State Array


AES Add Round Key
Process:

47= 0100 0111

AC= 1010 1100

X-OR= 1110 1011 -> EB

37= 0011 0111

77 = 0111 0000

X-OR=0100 0111 -> 40


AES Add Round Key
94= 1001 0100

66= 0110 0110

X-OR= 1111 0010 -> F2

ED = 1110 1101

F3 = 1111 0011

X-OR= 0001 1110 -> 1E

Continue the Process for every column.


AES Add Round Key

47 40 A3 4C AC 19 28 57 EB 59 8B 1B
* ->
37 D4 70 9F 77 FA D1 5C 40 2E A1 C3
94 E4 3A 42 66 DC 29 00 F2 38 13 42
ED A5 A6 BC F3 21 41 6A 1E 84 E7 D6

State Array Round Key Final Output


Thank You
HOPE FOR THE BEST

You might also like