atakoute_CS3626Sp01_Assignment03
.docx
keyboard_arrow_up
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
Related Questions
Encrypt
The following correspondence between letters and numbers is used in the Caesar cypher.
a
b
d
e
f
i
k lm n o
r
u
V
W X y z
1
2
3
4
6
7
8
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Encrypt the animal name
zebra with the Caesar cypher with a key of 25. What is the encrypted animal name (enter a string of letters with no spaces)?
Save
Submit
You have used 0 of 1 attempt
Decrypt
An animal name was encrypted with the scheme described above. The encrypted animal name is azmchbnns . What is the animal name?
Save
arrow_forward
Difficult Intro to Elementary Number Theory Homework problem. This is not a computer programming homework problem.
arrow_forward
Q7: Using the same notations as in the lecture, e.g., p and q are the two primes
and e and d are the public key and private key, respectively, p = 5, q = 13 and e=
5. Using the phi(n) that you found in question 6 and the Extended Euclidean
algorithm yields d = 29. What is the cipher text C when encrypting M = 17?
arrow_forward
cryptography
arrow_forward
Encrypt
The following correspondence between letters and numbers is used in the Caesar cypher.
a b
c d
f
h
i
j
k lm n
t
V W
e
g
6.
u
y
0 1
2 3
4
7
8.
9.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Encrypt the animal name
zebra with the Caesar cypher with a key of 3. What is the encrypted animal name (enter a string of letters with no spaces)?
Decrypt
An animal name was encrypted with the scheme described in the previous question (it was encoded with the key 3). The encrypted animal name is pduprw .What is the
animal name?
arrow_forward
You are given the following parameters in RSA cryptosystem:
p = 11, q = 13, e = 13
a) Find the integer d.
b) List down the public key and private key.
You need to encrypt the plaintext message, M = OF.
c) Convert this message to value according to ASCII table.
To encrypt this message, you can either combine the value, or separate it into the blocks of 2 digits (Hint: it must satisfy the condition M < n).
d) Encrypt and decrypt the message OF.
e) If the decimal value (not character) of ciphertext is 188267, decrypt this value and convert it to an appropriate message according to the ASCII table.
arrow_forward
E x e r c i s e • 1 :
Apply frequency test to verify the randomness of the output of the
following text:
1. The following plaintext:
In cryptography, a transposition cipher (also known as a permutation
cipher) is a method of encryption which scrambles the positions of
characters (transposition) without changing the characters themselves.
Transposition ciphers reorder units of plaintext (typically characters or
groups of characters) according to a regular system to produce a
ciphertext which is a permutation of the plaintext. They differ from
substitution ciphers, which do not change the position of units of
plaintext but instead change the units themselves. Despite the difference
between transposition and substitution operations, they are often
combined, as in historical ciphers like the ADFGVX cipher or complex
high-quality encryption methods like the modern Advanced Encryption
Standard (AES).
laintexts can be rearranged into a ciphertext using a key, scrambling the
order of…
arrow_forward
i need the answer quickly
arrow_forward
Simple python code
arrow_forward
Python
Simple program please
Thank you ??
arrow_forward
2
arrow_forward
Please help
Add c program for encrypt decrypt using
Shift cipher.
Only small letters in string
arrow_forward
Toy encryption scheme. It encrypts plaintexts that consist of only uppercase letters and the underscore character (27 characters total):
ABCDEFGHIJKLMNOPQRSTUVWXYZ_
Note that the underscore character is part of the alphabet and will also be encrypted. A key in this scheme consists of 4 digits, each from 0 to 9. Each digit tells how much to shift one character, that is, change it to the character that many positions later in the alphabet. If the shift goes past '_', then we wrap around to the beginning.
The key is applied separately to each group of 4 letters in the message. For example, if the message HI_SALLY is encrypted with the key 2407, the H would be shifted by 2, the I by 4, the underscore by 0, and the S by 7. Then we would start over with the first digit of the key, shifting A by 2, L by 4, and so on. So the ciphertext would be: JM_ZCPLE.
Give the encryption of the following messages with the key 2641.
a. SELL_GME
b. FRANZ_IS_MOLE
c. DEPLOY_ALL_DIVISIONS
arrow_forward
##Encrypt the message
WATCH YOUR STEP
by translating the letters into numbers, applying the encryption function
f(p) = (-7p+2), and then translating
The numbers back into letters
arrow_forward
Complete the function encrypt, which takes an unencrypted, plaintext message called plaintext and encrypts it according to the following
algorithm. The function then returns the encrypted ciphertext message.
1. Using a for-loop, swap the character at each even-indexed position with the one to its right. (Examples: abcdefg becomes badcfe;
abcdefg becomes badcfeg) You'll have to carefully accomodate for even-lengthed and odd-lengthed strings.
2. Then, using another for-loop, replace every uppercase letter with its lowercase equivalent, and replace every lowercase letter with its
uppercase equivalent.
3. (May be combined with the loop in the previous step in the code.) Except for the character o, replace each digit character with 10 minus
that digit. (Examples: 2 becomes 8, 9 becomes 1.) Hint: use ord and/or chr and/or str and/or int instead of a 10-way if-
statement!
Examples:
Function Call
encrypt('abCDefGHIJKLMnopQ')
encrypt('ABCdefGHIjkL')
encrypt('0123456789')
encrypt('123456789')…
arrow_forward
Using the ∑ = {0, 1}, Write the regex for the following descrip on: 1. {w | w has an even number of 0s and each 0 is followed by at least one 1} 2. {w | w doesn’t contain 01}
arrow_forward
4. The following algorithm gives a test if a given number is prime. Write a script to test it. Then try it out on
the numbers: 4058879 (not prime), 193707721 (prime):
(a) Input P
(b) Initialize N to 3
(c) Find remainder R when P is divided by N
(d) While R#0 and N< VP repeat:
Increase N by 2
Find R when P is divided by N
(e) If R#0 then
P is prime
Else
P is not prime
(f) Stop
arrow_forward
Please write the code in python.
CountRepetitions that takes a ciphertext as an argument and returns the total number of repetitions between all 16-byte blocks
arrow_forward
Experiment 1: IMPLEMENTATION OF CAESAR CIPHER
Objective:
To implement the simple substitution technique named Caesar cipher using C+ language.
Theory:
To enerypt a message with a Caesar cipher, each letter in the message is changed using a
simple rule: shift by three. Each letter of the message is shifted a fixed distance (3 for
example) down the alphabet, A becomes D, B becomes E, and so on. For the last letters,
we can think of alphabet as a circle and "wrap around", W becomes Z. X becomes A, Y
becomes B, and Z becomes C. To change a message back, cach letter is replaced by the
one three before it.
Example
ABCDEFGHIJKLMNOPQRSTUVWXYZ
t t t t t t t t ttt t t t t t t tt t t t t t t ft
DEFGHIJKLMNOPQRSTUVW XY Z ABc)
digorithm
STEP-1: Read the plain text from the user.
STEP-2: Read the key value from the user.
STEP-3: If the key is positive then encrypt the text by adding the key with each character
in the plain text.
STEP-4: Else subtract the key from the plain text.
STEP-5: Display the…
arrow_forward
In the previous modules, you were introduced to the contributions of various
scientists in the development of early astronomical concepts. As a review, use the
Pigpen cipher below to decode the words listed in the table. Choose from the
options below the corresponding description of the decoded words. Write your
answer in alphabetical order.
ABC JKL
S
DE F
W
XXY
GHI
V
Words for Decoding
Decoded Words Description
On
VELV>TL
D>EL
LEA FOL
arrow_forward
make a code , if you can uses mathlab
keep basic code no if or return
arrow_forward
comptuer programming
arrow_forward
Can you please show the shifts for the encrypt & decrypt in this format?
For example, like this :
Example:ABCDEFGHIJKLMNOPQRSTUVWXYZ Row 1FGHIJKLMNOPQRSTUVWXYZABCDE Row 2
If the plaintext to encrypt is:THIS IS THE ANSWER
The ciphertext becomes:YMNX NX YMJ FSXBJW
This is for me to help understand and to redo the problem for studying. Thank you!!
arrow_forward
Provide me complete solution of question thanks solve all parts step by step please
arrow_forward
Lab Assignment 1: Vigenere Cipher
Overview: You are required to implement the Vigenere Cipher using any programming language
of your choice. Your program should be able to encrypt any given message written in text. Your
program should allow the user to submit a message for encryption (the message must use text
only). You should use the following message to demonstrate the encryption: “Party on the Quad."
Your program should allow the user to input the key for performing the encryption. Please use the
following key to demonstrate the encryption process: "Homecoming."
arrow_forward
Ex/ if the following message “paperx” is encrypted by using Hill cipher and converted into ciphertext "EJGPNH" what is the key matrix if you know that the key is (2*2) ?
arrow_forward
Help plz
arrow_forward
True/False 4. The number of times n can be divided by 2 is exp( n).
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- Encrypt The following correspondence between letters and numbers is used in the Caesar cypher. a b d e f i k lm n o r u V W X y z 1 2 3 4 6 7 8 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Encrypt the animal name zebra with the Caesar cypher with a key of 25. What is the encrypted animal name (enter a string of letters with no spaces)? Save Submit You have used 0 of 1 attempt Decrypt An animal name was encrypted with the scheme described above. The encrypted animal name is azmchbnns . What is the animal name? Savearrow_forwardDifficult Intro to Elementary Number Theory Homework problem. This is not a computer programming homework problem.arrow_forwardQ7: Using the same notations as in the lecture, e.g., p and q are the two primes and e and d are the public key and private key, respectively, p = 5, q = 13 and e= 5. Using the phi(n) that you found in question 6 and the Extended Euclidean algorithm yields d = 29. What is the cipher text C when encrypting M = 17?arrow_forward
- cryptographyarrow_forwardEncrypt The following correspondence between letters and numbers is used in the Caesar cypher. a b c d f h i j k lm n t V W e g 6. u y 0 1 2 3 4 7 8. 9. 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Encrypt the animal name zebra with the Caesar cypher with a key of 3. What is the encrypted animal name (enter a string of letters with no spaces)? Decrypt An animal name was encrypted with the scheme described in the previous question (it was encoded with the key 3). The encrypted animal name is pduprw .What is the animal name?arrow_forwardYou are given the following parameters in RSA cryptosystem: p = 11, q = 13, e = 13 a) Find the integer d. b) List down the public key and private key. You need to encrypt the plaintext message, M = OF. c) Convert this message to value according to ASCII table. To encrypt this message, you can either combine the value, or separate it into the blocks of 2 digits (Hint: it must satisfy the condition M < n). d) Encrypt and decrypt the message OF. e) If the decimal value (not character) of ciphertext is 188267, decrypt this value and convert it to an appropriate message according to the ASCII table.arrow_forward
- E x e r c i s e • 1 : Apply frequency test to verify the randomness of the output of the following text: 1. The following plaintext: In cryptography, a transposition cipher (also known as a permutation cipher) is a method of encryption which scrambles the positions of characters (transposition) without changing the characters themselves. Transposition ciphers reorder units of plaintext (typically characters or groups of characters) according to a regular system to produce a ciphertext which is a permutation of the plaintext. They differ from substitution ciphers, which do not change the position of units of plaintext but instead change the units themselves. Despite the difference between transposition and substitution operations, they are often combined, as in historical ciphers like the ADFGVX cipher or complex high-quality encryption methods like the modern Advanced Encryption Standard (AES). laintexts can be rearranged into a ciphertext using a key, scrambling the order of…arrow_forwardi need the answer quicklyarrow_forwardSimple python codearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education