联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2020-02-21 09:13

San Diego State University

CS574 Computer Security

Homework Assignment #1

Due: February 24, 2020 11:59 PM

? Please type the solutions using a word processor such as MS Word, Latex, or write

by hand neatly and upload the scanned copy of it.

? Turn in your assignment through blackboard.

1. Decrypt the following ciphertext which was encrypted with Caesar Cipher. The key shift is

given in each case. Show the substitution key mapping in each case.

a. Cipher Text: dtzw ynrj nx qnrnyji xt itsy bxfyj ny sn qnansl xtrjtsj jqxjx qnaj

Key Shift: 5

b. Cipher Text: xli gsso aew e kssh gsso ew gssow sk erh ew gssow ks wil airx

Key Shift: 4

2. For any block cipher, the fact that it is a nonlinear function is crucial to its security. To see

this, suppose that we have a linear block cipher EL that encrypts 128-bit blocks of

plaintext into 128-bit blocks of ciphertext. Let EL(k, m) denote the encryption of a 128-bit

message m under a key k (the actual bit length of k is irrelevant). Thus

EL(k, [m1 XOR m2]) = EL (k, m1) XOR EL (k, m2) for all 128-bit patterns m1, m2

Describe how, with 128 chosen ciphertexts, an adversary can decrypt any ciphertext

without knowledge of the secret key k. (A "chosen ciphertext" means that an adversary

has the ability to choose a ciphertext and then obtain its decryption. Here, you have 128

plaintext/ciphertext pairs to work with and you can choose the value of the ciphertexts.)

3. This problem uses a real-world example of a symmetric cipher, from an old U.S. Special

Forces manual (public domain). See the attached document on page 3.

a. Using the two keys (memory words) “cryptographic” and “network security”, encrypt the

following message:

“Be at the third pillar from the left outside the lyceum theatre tonight at seven. If you are

distrustful bring two friends.”

Make reasonable assumptions about how to treat redundant letters and excess letters in

the memory words and how to treat spaces and punctuation. Indicate what your

assumptions are.

b. Decrypt the ciphertext. Show your work.

4. Assume that we are planning to decrypt the cyphertext which was encrypted with DES

encryption. We are using an ordinary household computer with 2GHz processor. Estimate

the amount of time necessary to crack DES by testing all 56-bit possible keys. Also

estimate the similar time for AES encryption with 128-bit key. (Assume that machine

takes 100 cycles per brute force against a single key)

Note: For this question, the exact answer is not as important as approach to calculate the

answer.

5. List three applications in which a stream cipher would be desirable. Be sure to explain

your answer.

6. Write a program to implement DES encryption.

The program should read the message text from a text file and encrypt it with the key

provided by the user during runtime. The program should overwrite the plain text file

with the cipher text after encryption. Your program should also allow the user to decrypt

the encrypted file. The original text message in the file should be completely recovered

upon decrypting the file.

Function description:

Your program should have two separate functions for encryption and decryption each

will accept the file reference and key as arguments.

Function should encrypt/decrypt the original file. Your function may not return anything

to main program. Consider the following example:

def encryptFile(file_reference, key):

#your code goes here

def decryotFile(file_reference, key):

#your code goes here

File_reference = open("demofile.txt", "w")

encryptFile(file_reference, “thisisakeyfordes”)

decryptFile(file_reference, “thisisakeyfordes”)

Note: You can use cryptographic libraries to implement the DES algorithm. However, you

are encouraged to write your own implementation of DES. You will get 10 extra credits if

you write your own implementation of DES.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp