Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

NO ANSWERS WEREN'T HELPFUL PAST (6th times posting) Cryptography: Two-Time Pad, or All-Nonced-Up Question: KPA two-time pad attack. What is the name of the book

NO ANSWERS WEREN'T HELPFUL PAST (6th times posting)

Cryptography: Two-Time Pad, or All-Nonced-Up

Question: KPA two-time pad attack. What is the name of the book that you decrypted (not the filename but the book title)? please tell me the book name

Description:

known text file name: b02e4E82.bin (File link: https://www75.zippyshare.com/v/fMddIfn4/file.html)

Ecrypted KAP file name: 0ddd5a8c.bin (File link: https://www86.zippyshare.com/v/3zeDbGAy/file.html)

This assignment is centered on cracking a cipher in the case that a nonce is misused. You will see two subdirectories: KPA (known plaintext attack) and COA (ciphertext-only attack). In each of these directories are 58 books from Project Gutenberg, encrypted and with their titles masked. You have been assigned to decrypt one file from KPA and one file from COA (please see the mapping file in this directory). In the KPA directory, all files were encrypted using AES in CTR mode using the same key and the same IV. Furthermore you have been given a piece of plaintext for one of these files, namely b01e4e62 which happens to be the Declaration of Independence. This should allow you to use the two-time-pad trick to decrypt any file in the KPA directory. Following codes didn't work! Please show me output result before posting your answers

import base64

import requests

B) :

# Known plaintext file

url = "https://www86.zippyshare.com/v/HHY3xZRb/file.html"

response = requests.get(url)

known_plaintext = base64.b64decode(response.content)

# Target file

url = "https://www86.zippyshare.com/v/3zeDbGAy/file.html"

response = requests.get(url)

target_ciphertext = base64.b64decode(response.content)

C) :

keystream = bytearray(len(known_plaintext))

for i in range(len(known_plaintext)):

keystream[i] = known_plaintext[i] ^ target_ciphertext[i]

D) :

plaintext = bytearray(len(target_ciphertext))

for i in range(len(target_ciphertext)):

plaintext[i] = target_ciphertext[i] ^ keystream[i]

E) :

print(plaintext.decode())

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

. . .

Answered: 1 week ago