Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program to encrypt and decrypt binary files using S-DES (Simplified DES) in the Cipher Block Chaining mode. The program takes the input of

Create a program to encrypt and decrypt binary files using S-DES (Simplified DES) in the Cipher Block Chaining mode. The program takes the input of an initial key and an initial vector, reads the plaintext or ciphertext from a file, conducts the encryption or decryption, and writes the resulting ciphertext or plaintext into a second file.

You can use any of your preferred programming languages and operating systems. If the programming language is not C/C++/Java/Python, you will need to demo your code on your own computer.

Your program must following the following input and output formats.

Input Format: The program should take a command in the following format. (java) mycipher -m mode -k initial_key -i initial_vector -p plaintext_file -c ciphertext_file mode: can be only encrypt or decrypt initial_key: 10-bit initial key initial_vector: 8-bit initial vector plaintext_file: a binary (not text) file to store the plaintext ciphertext_file: a binary (not text) file to store the ciphertext

Output Format: The program should print output in the following format. k1=subkey 1 k2=subkey 2 plaintext=all bytes of the plaintext separated by blanks, starting from the first byte ciphertext= all bytes of the ciphertext separated by blanks, starting from the first byte

Sample Test Cases mycipher -m encrypt -k 0111111101 -i 10101010 -p f1 -c f3 k1=01011111 k2=11111100 plaintext=00000001 00100011 ciphertext=11110100 00001011 mycipher -m decrypt -k 0101010101 -i 00000000 -p f4 -c f2 k1=00011011 k2=10101100 ciphertext=00000001 plaintext=01101000

where f1 is a binary file with two bytes 012316,

and f2 is a binary file with one byte 0116.

Decrypting the attached file cipher.jpx with the command "mycipher -m decrypt -k 1010010001 -i 10101010 -p plain.jpg -c cipher.jpx" will result in the following plain.jpg file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions