Mercy College Programing Project

Assignment – Stream CipherCryptography
1. Suppose an LFSR of degree 5 is used as a stream cipher and the following plaintext π‘š and
ciphertext 𝑐 is known: π‘š = 00100 11000, 𝑐 = 10110 01110. Compute the feedback
polynomial, the characteristic polynomial, the period and the complete keystream.
Hint: The first five bits of π‘š βŠ• 𝑐 give a state (reverse the order). The next five bits yield
linear equations in the unknown feedback coefficients.
2. Given four words, a = 1, b=0, c=0, d = 0, do the following calculation: π‘Ž = π‘Ž + 𝑏 ; 𝑑 = 𝑑 βŠ• π‘Ž ;
𝑑 β‹˜ 16. Remember, use updated values in the subsequent calculation. For example, after a =
a+b, use new a in the next d = 𝑑 βŠ• π‘Ž operation.
3. Code read and test. Here is one simple code to check salsa20 stream cipher.
1. Replace the word in the code β€˜yourname’ with your name. screenshot the code plus the
result.
2. Replace the secret key with your cell phone number plus β€˜abcdefghijklm’ in total 32 bytes
or 256 bit key. Screenshot the code with the result.
from Crypto.Cipher import Salsa20
plaintext = b’salsa20 is fun: Attack at dawn : yourname’
#print(plaintext)
# secret 32byte (256 bits)
secret = b’abcdefghijklmnopqrstuvwxyz123456′
cipher = Salsa20.new(key=secret)
msg_nonce = cipher.nonce
#print(msg_nonce)
msg = cipher.nonce + cipher.encrypt(plaintext)
#print(msg)
# decryption
# msg_nonce = msg[:8]
ciphertext = msg[8:]
cipher = Salsa20.new(key=secret, nonce=msg_nonce)
plaintext = cipher.decrypt(ciphertext)
print(plaintext)

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER