Question: generatePad ( seed , k , l ) returns a pseudo - random list of 1 s and 0 s , generated by an [

generatePad(seed, k, l)
returns a pseudo-random list of 1 s and 0 s , generated by an [N,k] LFSR, where N= length of seed
parameters:
seed : list of 1's and 0's
k: int , tap position
I : int, length of the sequence to be generated
return type: list of 1's and 0's
encrypt (message, seed, k)
takes a string message and returns it as an encrypted string using an [N, k] LFSR
parameters:
message : string of characters from Base64 set
seed : list of 1's and 0's
k : int, tap position
return type: string
heres hwo they should be tested: | THE EXPECTED RESULT MUST MATCH THE RESULT
# test 5: generatePad()
print("
5. Testing generatePad(), with:")
print(">seed =[1,1,0,0,0,1,1,0,0,1,0]")
print(">k =9")
print(">length =20
")
pad = encryption.generatePad([1,1,0,0,0,1,1,0,0,1,0],9,20)
print("Expected: 11011111001101000111")
print("Actual: ",*pad)
# test 6: encrypt()
print("
6. Testing encrypt()")
plain = "IdLoveToStayHereAndBeNormalButItsJustSoOverrated"
encrypted = encryption.encrypt(plain,[1,0,1,0,0,1,0,0,1,0],8)
decrypted = encryption.encrypt(encrypted,[1,0,1,0,0,1,0,0,1,0],8)
print("Input: ", decrypted)
print("Expected: F2n9bUBl5BPGNMm1sypLMADHzuvTjGk4YD8hG+96lMmA24qX")
print("Actual: ", encrypted)
print("Decrypted:", decrypted, "
")
generatePad ( seed , k , l ) returns a pseudo -

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!