DC10002 - Editorial

DC10002 - Editorial

PROBLEM
Link to the Practice Question can be found: CodeChef: Practical coding for everyone

PREREQUISITE
Cryptography

DIFFICULTY
Easy

PROBLEM
Assume Eve has captured a few ciphertexts. You need to write the decryption program such that with given cipher text and key, eve can recover the plaintext.

EXPLANATION

  1. The picture that is given is for encryption; we need to write the algorithm/code for decryption .That means the decryption algorithm need to perform totally opposite operation.

  2. So in the round1 in the decryption process, we will need to use key K4.

  3. We will get the keys from the sub key generation process as described in the questions.

K1 (32-bit) corresponding to the key consist of four characters
K2 (32-bit) after the circular-right shift of K1 by 2 positions.
K3 (32-bit) after the circular-right shift of K1 by 4 positions.
K4 (32-bit) after the circular-right shift of K1 by 8 positions

  1. Below steps need to follow in the decryption process of Round 1 :
  • First extracts the binary value of C’’,A’’,B’’,D’’ from the given hexadecimal inputs.
  • Pass the 32-bit of D’’ through PBox4 , and XOR the output of that with the B’’. Next passed that output through SBOX4 and store it in B’.
  • Perform the XOR operation of D’’ with the key K4. Next passed that output through SBOX4 and store it in D’.
  • The output of the Round1 will be C’’, A’’ ,D’,B’.
  1. Similarly perform the decryption process just like above for Round 2, Round 3, Round 4 as per the picture .

Solution: https://drive.google.com/file/d/18MWdIkVEuorZpmCggoWub6VJjvtoitLU/view?usp=sharing