atakoute_CS3626Sp01_Assignment03

.docx

School

Kennesaw State University *

*We aren’t endorsed by this school

Course

3626

Subject

Computer Science

Date

Apr 3, 2024

Type

docx

Pages

10

Uploaded by PresidentMooseMaster1069

- 1 - CS3626 Homework 03 Spring 2024 DES Total Points: 25 Be as brief as possible and use your own words when describing concepts.   SHOW ALL WORK for Questions requiring calculations and algorithms. Q-1: Using the algorithm given below encrypt the following ASCII message using the ASCII key given below: Message: ‘X4zr’ (You’ll need to encrypt 2 blocks to complete this message) Algorithm: Feistel Block Size: 16 bits Number of Rounds: 2 Key Round 1 = ‘B’ Key Round 2 = ‘e’ Function: F = (((RE i * Key) >> 4) + RE i ) mod 2 8 NOTE: * is regular multiplication operator and + is LOGICAL OR Operator, i = round number (where, when i = 0; LE 0 , RE 0 are inputs to round 1) >> means bit-shift right meaning binary value 01001111 >> 4 becomes 00000100: 1111 bits shifted out and zeros shifted in. SHOW FEISTEL STRUCTURE below with the values of LE i , RE i , the result of F and the result of F LE i for each round and block of encryption. K1 = 0100 0010, K2 = 0110 0101 1st block: 0101 1000 0011 0100 L 0 : 0101 1000 R 0 : 0011 0100 R0 * K1 = 3432 equivalents to 110101101000 R0*K1>>4 = 1101 0110 (R0*K1)>>4 + R0 = 1111 0110 Hence F1 = 1111 0110 R1 = F1 ⊕L0 = 1010 1110 L1: 0011 0100 R1: 1010 1110 R1 equivalents to and K2 equivalents to R1 * K2 = 17574 equivalents to 1000 1001 0100 110 (R1*K2)>>4 = 1000 1001 010 (R1*K2)>>4 + R1 = 10011101110 equivalents to 1262 and 1262(mod 256) = 238 equivalents to 1110 1110 Hence F2 = 1110 1110 R2 = F2 ⊕L1 = 1101 1010 L2: 1010 1110 R2: 1101 1010 Last Swap give: L3: 1101 1010 R3: 1010 1110 After the first round we got: 1101 1010 1010 1110 equivalents to DAAE 2nd block: 0111 1010 0111 0010
- 2 - L 0 : 0111 1010 R 0 : 0111 0010 R0 * K1 = 7524 equivalents to 1110101100100 R0*K1>>4 = 111010110 (R0*K1)>>4 + R0 = 111110110 equivalents to 502 and 502 mod 256 = 246 246 equivalents to 1111 0110 Hence F1 = 1111 0110 R1 = F1 ⊕L0 = 1000 1100 L1: 0111 0010 R1: 1000 1100 R1 equivalents to 140 and K2 equivalents to 101 R1 * K2 = 14140 (R1*K2)>>4 = 1101110011 (R1*K2)>>4 + R1 = 1111111111 equivalents to 1023 and (1023 mod 256) = 255 equivalents to 1111 1111 Hence F2 = 1111 1111 R2 = F2 ⊕L1 = 1000 1101 L2: 1000 1100 R2: 1000 1101 Last Swap: L3: 1000 1101 R3: 1000 1100 After the second round we got: 1000 1101 1000 1100 equivalents to 8D8C What is the transmitted ciphertext (provide in hexadecimal): DAAE8D8C 6 points FYI, YOUR PROJECT WILL IMPLEMENT FEISTEL using Galois Field Math in Function F, should you wish to start Feistel Implementation now with a regular function and later replacing F with Galois F.
- 3 - Q-2: What is the result of the following inputs to these DES (sort-of) functions: Input[16-bits]: 0x3C1D [MSB = bit position 1 left to right] Expansion Box: First input bit position [14] represents output position [1], that is counting from 1 not 0. 14 16 3 6 8 13 5 15 13 9 14 7 8 11 4 12 10 2 10 2 1 7 5 12 What is output (in hexadecimal) of the expansion box function: F6A303 2 points Q-3: The output above is broken into 6-bit segments and sent from left to right to the following four DES S-Boxes in order S1, S2, S3 and S4. What is the resulting Output (in hexadecimal): 64F8 2 points Q-4: The output above is then circular bit shifted left by 5 bits. What is the resulting shifted Output (in hexadecimal): 9F0C 2 points
- 4 - Q-5: Upgrade your Caesar algorithm to Vigenere to encrypt and decrypt. Also upgrade it to allow changing the hard coding of the ASCII alphabet (if not already done). E.g. set a variable (however your language does this) to define an alphabet. As an example, for C++ std::vector or std::string is recommended, such as: std::string alphabet = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789”; where a = 0, b = 1, c = 2 etc… --- being changed and rebuilt to use this alphabet --- std::string alphabet = “0123456789abcdefghijklmnopqrstuvwxyz”; where ‘0’ = 0, ‘1’ = 1, ‘a’ = 10 etc… Upgrade your vigenere code to read from an input file and an output file. These can be supplied as arguments or hard-coded (but arguments will work better for future assignments), e.g. vigenere <input_file> <key> <output_filename> <e = encrypt | d = decrypt> Example execution on command line: ./vigenere plaintext.txt mykeyisthis cyphertext.txt e ****************** Example BEGIN Example **************************** Using the alphabet: std::string alphabet = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789” NOTE: PASS through any values not in your alphabet. For example: if KEY = “box” Message: I have a dot.number(1) Comma, Colon: and parenthesis Cyphertext result: J vxws x eCQ.oIJcsO(2) QLnAx, DCIpB: xor MbFBoHEfGFt Spaces are not in alphabet and pass through, punctuation and spaces do as well in this example. ****************** Example END Example **************************** ------------------ BEGIN ASSIGNMENT REQUIRED RESPONSE INSTRUCTIONS -------------------- Response 1: Using plain1.txt as input file------------------------------------------------------------------------------------- Alphabet “abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789” The underscore above ( _ ) between z and A is meant to represent the SPACE character (0x20). Use Key: Key Any plaintext value not in alphabet is just copied through untouched. Any key value not in alphabet should generate an error and exit. Key is indexed only on valid alphabet characters, a character outside the alphabet does not cause key to move to next character in key. Using this key = “Key” and alphabet above encrypt plain1.txt and provide the cypher output here: dsL1hFXeQOwXb5qB,FrH,3sayPODFXtR3DPOuROr ODfB7:XjRha6qE,D1nEXB4. Hint: do you see the text?: ,D1nEXB4 Response 2: Using cypher2.txt as input file.---------------------------------------------------------------------------------- Next, change the alphabet to: std::string alphabet = “aeiouycdx_IVXLCDMK012”; // the _ here is a SPACE (0x20) Using this alphabet and key = “Key” decrypt cypher2.txt and provide the plaintext output here: Region:_MCMXLCV__Hawking_Text:_X121_Use_CHROMA_V2 Hint: CHROMA V2 Provide source-code per instructions below. Keep this code it will be revisited. 8 points
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help