Question: I had asked below question to expert at chegg and he gave me a code which was having error. I have mentioned both code and
I had asked below question to expert at chegg and he gave me a code which was having error. I have mentioned both code and error below. Please analyse and give me errorfree code which will give expected output as mentioned in question.
Question:
Implement one round of the simplified DES presented in section Write a method that performs one
round of encryption. It takes as parameters a bit input and an bit key. It returns a bit result.
Write a main methodmain section that tests this method. I will provide test inputoutput pairs and
more details on implementation but you should have enough to start.
Added February th
Please also write a main methodmain program that reads the plaintext and key, as decimal integers,
from the command line, calls the method described above passing it these values, and then prints the
resulting ciphertext. Call the program either sdesround.py or Sdesround.java.
For example, one should be able to run the program as either:
python sdesround.py
java Sdesround
And it will print the answer in both binary and decimal. In this case, it should print
Binary: b decimal:
Code which chegg provided me earlier:
public class Sdesround
Sample permutation and Sboxes you may need to define your own based on DES
static int perm ;
static int sbox ;
public static int encryptRoundint input, int key
Key mixing: XOR input with the key
int mixed input key;
Substitution: Apply the Sbox
int substituted sboxmixed;
Permutation: Apply the permutation
int permuted ;
for int i ; i ; i
permuted substituted i & permi;
return permuted;
public static void mainString args
if argslength
System.out.printlnUsage: java Sdesround
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
