Double Matrices Cipher

All submissions for this problem are available.
Alice wants to send a message to Bob over an insecure channel. Eve is the eavesdropper. Hence, Alice encrypts her message in the following way: Assumptions : Plaintext represents the original message. Ciphertext represents the cipher message. The key are used to encrypt the plaintext. Consider the alphabets (8bits) are represented by their ASCII code. There are no spaces, newline or other punctuation symbols in the plaintext. Key Selection : Alice chooses a key such that $ length(key) < 256 $ characters. Encryption Process: 1. Consider the plaintext as blocks, each size of 256characters. If the last block has less than 256 characters then do the padding with 0 (or null value). 2. For each block of 256characters from the plaintext, do the following: 3. Fill the plaintext characters onebyone into the $ 16 \times 16 $ matrix (called plaintextmatrix) from lefttoright (each row) toptobottom way. 4. Take a $ 16 \times 16 $ matrix fill it with numbers starting from 0 upto 255 in row wise manner (second matrix). 5. Construct another matrix of size $ 16 \times 16 $ and fill it with the key such that the key is repeated multiple times in sequential manner if necessary (keys are repeated if key size is less than 256) in order to fill the entire matrix (last repeated key may be partially used). Let it be called as keymatrix. 6. Take XOR of each element of keymatrix with the corresponding element of secondmatrix to form another matrix call it as finalkeymatrix of size $ 16 \times 16 $. 7. Finally, XOR between finalkeymatrix and plaintextmatrix. We get the ciphermatrix. 8. Then we take out elements one by one from the ciphermatrix in row wise manner to get cipher text. 9. Finally, we get a block of 256 characters, of the ciphertext. Assume Eve has captured a few ciphertexts. You need to write the decryption program such that for the given key and the ciphertext it generates the correct plaintext. Desired input and output format: ###Input: 9,20,21,9,2,28,26,14,14,12,0,11,16,4,10,5,1,6,27,6,25,23,20,13,4 HACKER ###Output: ATTACKTHENORTHGATEATNIGHT (Note that the ciphertext is given in ASCII form.)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