Starting from:

$25

BBM465-Project 1 Solved

The aim of this project is to develop a Feistel Cipher and understand the internals of Feistel ciphers e.g. DES, IDEA, RC4/5. You will learn multi round ciphers that enable to encrypt/decrypt data with the right key. You will also learn to implement ECB, CBC and OFB encryption modes for your Feistel Cipher.  

A Feistel Cipher has the below format as discussed in the class:

   

A Feistel Cipher has d rounds of encryption, where in ith round, a one-way scramble function f  is applied to right half of the data Ri with subkey Ki.  

In this project, the main parameters of your Feistel Cipher will be as follows:

•        10 rounds of encryption/decryption

•        96 bit block size

•        96 bit key size

 

If the length of the message is less than the block size, the message will padded with all zeros to obtain a 96 bit block.

Scramble Function: 

In our project, we will assume that scramble functions f0, f1, f2 … fd-1 applied on each round are all same. In other words, you will have only one scramble function, which is defined as follows

 

In the above scramble function, Ri is XORed with Ki first and the result is divided into 8 pieces of 6-bit parts (P1, P2, P3, ... P8). Then, P1 and P2 are XORed and saved as the 9th  part, P3 and P4  are XORed and saved as the 10th  part and so on. As a result of these operations, you will have 12 pieces of 6-bit parts. Then, each 6-bit part is sent to a substitution box like in the DES algorithm. You are expected to use below substitution box:

  

 

The substitution box works in similar way to DES boxes. Outer bits of the input are used as the row number, inner bits are used as the column number. The results of 12 substitution box operations will be combined as a 48 bit output and a permutation function will be applied on this output. The permutation function swaps each even digit with the previous odd digit. Assuming Bi represents ith bit of the output, the permutation function will do following operation for all bits of the result (0≤ ≤47): Temp = B2i

B2i = B2i+1 B2i+1 = Temp Subkey Generation: 

In each round, you will do apply a left circular shift on the key and a permuted choice on the key as shown in below figure:

  

In the even numbered rounds, the permuted choice will output even digits of the key to the related round. In other words, in rounds 0, 2, 4, 6, and 8, the permuted choice function will output 0, 2, 4, 6, 8, …. 94th  bits, which is 48 bits in total. In the other (1,3,5,7,9) rounds,  the permuted choice function will output odd digits, which are 1, 3, 5, 7, 9, …. 95th  bits.

 

Encryption modes: 

You will implement ECB, CBC, and OFB modes for your encryption algorithm. In case, if CBC or OFB modes are selected, your program should use a vector filled with 1s as the Initialization Vector.

 

 

1                Usage and testing
Your program must be named as “BBMcrypt” and should run from the command line with the following parameter format:  

BBMcrypt enc|dec -K key -I input -O output –M mode 

•        enc|dec specifies the action, which can be either encryption or decryption

•        -K key specifies the file name that contains encryption/decryption key, which is encoded in base64 encoding  

•        -I input specifies the input file name, which can be either plaintext or ciphertext  • -O output specifies the output file name, which can be either plaintext or ciphertext  

•        -M mode specifies the encryption mode, which can be ECB, CBC or OFB.  

 

Your program will be tested on different sized files using the above command line format. Thus, it is important to obey this command line format or otherwise, you will lose points.  

 

We will not test wrong parameters of users, such as missing input file name, key file name. However, -K, -I, -O, and -M parameters might be given in different orders on the command line (The first parameter must be always enc|dec).

             

More products