Circular Shift Cipher

All submissions for this problem are available.
Alice wants to send a message to Bob over an insecure channel. Eve is eavesdropper. Hence, Alice encrypt her message in the following way: Assumptions : Plaintext represents the original message. Ciphertext represents the encrypted message. The keys are used to encrypt the plaintext. Consider the characters (8bit) are represented by their ASCII code. There are no spaces, newline or other punctuation symbols in plain text. Key Selection : Alice chooses a keystream of 16 chars (128bits). Encryption Process: 1. Each block of the plaintext must have 128bits (if less must be padded by 0 (or null character)). 2. The first block (of 128bit) of plaintext will be directly XORed with the keystream (of 128bit). 3. For next block onwards, consider the first $ 6 $ bits of the $ keystream $ and convert it decimal $ d_1 $. Then make a circular leftshift of the $ keystream $ by $ d_1 $ position, compute new $ {keystream}_1 $. Example: The 128bit key can be consider as consists of 16 characters (as $ 16 \times 8 = 128 $). Let the 128bit key is $ C(0), C(1), \cdots, C(127) $. We consider the 6bits from the MSB part of $ C(0) $. If we assume that $ C(0) $ is 1010 1100, then the underlined portion (6bits) will be considered for the above calculation. 4. Now, XOR between 128bit $ {keystream}_1 $ and 128bit bock of the plaintext. 5. Similarly, for $ (i+1)^{th} $ block, consider the first $ 6 $ bits of the ${keystream}_{i1} $ convert it decimal $ d_i $. Then perform a circular shift of ${keystream}_{i1} $ by $ d_i $. XOR between 128bit $ {keystream}_{i} $ and 128bit $ (i+1)^{th} $ block of the plaintext. Assume Eve has captured a few ciphertext. You need to write the decryption program such that with given keystream and the ciphertext it recovers the correct plaintext.. Desired input and output format: ###Input: 0815191c0d060d0b1d010001040c060e6605695077507714427c455902536a52 IAMTHEHEISENBERG ###Output: ATTHECENTREOFITISTHEVERYWELLKNOW (Note: The ciphertext input is given in hexadecimal format)Author:  tkh_iem 
Tags  tkh_iem 
Date Added:  13082019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions