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

Security Lab Assignment1

This document provides instructions for a lab assignment on encrypting a binary message using a linear feedback shift register (LFSR). Students are asked to write a program that takes a binary plaintext, an LFSR polynomial, and initial vector as input, and outputs the encryption key and ciphertext. The instructions give examples and describe the steps to generate the key stream by shifting the initial vector according to the LFSR feedback function, then XORing this with the plaintext to produce the ciphertext. Grading criteria are also provided.

Uploaded by

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

Security Lab Assignment1

This document provides instructions for a lab assignment on encrypting a binary message using a linear feedback shift register (LFSR). Students are asked to write a program that takes a binary plaintext, an LFSR polynomial, and initial vector as input, and outputs the encryption key and ciphertext. The instructions give examples and describe the steps to generate the key stream by shifting the initial vector according to the LFSR feedback function, then XORing this with the plaintext to produce the ciphertext. Grading criteria are also provided.

Uploaded by

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

Cairo University

Faculty of Computers and Artificial intelligence


Information Technology Department
IT423 - Information and Computers Networks Security
Spring 2022

Lab Assignment (1)

Assignment deadline: - 10/11/2022


You should make the assignment group of 2 students, no late assignment will be accepted.
Each one of the team should know all the details of the assignment.

Assignment Requirements:-

Sheet1 Question6 Part D

Write a program to encrypt a binary message using LFSR.

Input: - Plain Text with any length (binary), Polynomial of LFSR (ex. X4+ X2+1), and the Initial
Vector.
Output: - Key and Cipher text (binary).

Hint: -

1. Get the feedback coefficients Ci …. C0


2. Get the XOR function of the left-most flip-flop from the coefficients.
3. Start shifting the initial vector for number of times equal to the length of the input binary
plaintext.
4. The key stream is the output of the right-most flip-flop.
5. The ciphertext = The binary plaintext XOR The key stream.
6. if the initial vector entered is false not match the polynomial, you print error message and let
me enter it again

Example: -

Inputs:
1. Binary Plain Text Xi = 100111001100
2. Polynomial LFSR: x4+x3+1
3. Initial vector: 1, 0, 0, 0
Steps:
1. The feedback coefficients: C0 = 1, C1 = 0, C2 = 0, C3 = 1
2. FF3 = FF3 FF0
3. The input binary message length = 12 so, shift till clk = 11

CLK FF3 FF2 FF1 FF0


0 1 0 0 0
1 1 1 0 0
2 1 1 1 0
3 1 1 1 1
4 0 1 1 1
5 1 0 1 1
6 0 1 0 1
7 1 0 1 0
8 1 1 0 1
9 0 1 1 0
10 0 0 1 1
11 1 0 0 1

4. The key stream Ki = 000111101011


5. The encrypted cipher Yi = Xi Ki (each bit in X is XORed with each bit in K)
So, Yi = 100000100111

Output:
Yi = 100000100111

Grading Criteria:-

Total mark: - 10 marks


Static polynomial (Fixed maximum power) → 1 mark
The input binary message length → 0.5 mark
Feedback Coefficients → 1.5 marks
XOR function of the left-most flip-flop → 1.5 marks
Shifting → 2 marks
Display the whole table → 1 marks
Display key stream → 1 marks
Ciphertext (Output) → 1.5 marks
1. Binary Plain Text Xi = 1111011
2. Polynomial LFSR: x3+x2+1
3. Initial vector: 1, 0, 1,
FF2=FF0+FF2
CLK FF2 FF1 FF0
0 1 0 1
1 0 1 0
2 0 0 1
3 1 0 0
4 1 1 0
5 1 1 1
6 0 1 1
7 1 0 1

1111011
1010011
0101000

You might also like