Answered step by step
Verified Expert Solution
Question
1 Approved Answer
cipher_in1.txt: 1011001111110000 cipher_in2.txt: 1011001000111010 cipher_out1.txt: 1100001011101010 cipher_out2.txt: 1001001100111111 Problem 3. 50 % Consider the block cipher inspired by the lightweight Simon cipher [1] depicted in
cipher_in1.txt:
1011001111110000
cipher_in2.txt:
1011001000111010
cipher_out1.txt:
1100001011101010
cipher_out2.txt:
1001001100111111
Problem 3. 50 \% Consider the block cipher inspired by the lightweight Simon cipher [1] depicted in Figure 1: - the block size is 16 bits, e.g. Li and Ri are 8 bits long; - Sk denotes a left cyclic shift by k bits; - denotes XOR; - "AND" denotes logical "and"; - Ki is the round key, which is 8 bits long. Figure 1: A 4-round toy cipher based on a Feistel network The cipher consists of 4 rounds. The key K is 32 bits long, and the round keys K0,K1,K2,K3 are such that K=K0K1K2K3, where denotes concatenation 1. Write an implementation allowing one to encrypt and decrypt with this toy cipher. Your implementation should provide a function that takes as input a 16bit block of plaintext and a 32-bit key, and outputs a 16-bit block of ciphertext. The blocks and keys can internally be represented in any way that you find suitable, but your implementation should read the input from a text file containing 16 digits ( 0 or 1), and should record the output in the same format. Sample output: The files cipher_in1.txt and cipher_in2.txt contain two sample input (plaintext) blocks, while cipher_out1.txt and cipher_out2.txt contain the corresponding output (ciphertext) blocks. Both pairs of plaintextciphertext are encrypted using the key in cipher_key. txt. NB: When implementing Feistel networks, be careful about the order of the left and right blocks at the output. The blocks are typically swapped one extra time after the last round in order to make decryption work correctly. If you are having trouble getting the correct input for the provided samples, try swapping the left and right blocks before or after the entire Feistel network
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started