subject

Use the instructor provided xor code to implement a scheme that allows you to encrypt and decrypt some data using symmetric encryption principles.

-you can implement any scheme that you want. either one of the schemes discussed in the class or a new one that you designed on your own.

-the key aspect is that you should generate several blocks from the input and you should do several rounds of encoding.

-implement the python code and show your results.

here is the provided code:

## xor script

from os import urandom



def genkey(length):
return bytearray(urandom(lenght))



def encrypt(plaintext, key):
return bytearray([ ord(plaintext[i]) ^ key[i] for i in range(len(



def main():
mymessage = "this is the plain text"
key = genkey
cipher = encrypt(mymessage, key)
print str(cipher)
decrypted_message = decrypt(cipher, key)
print decrypted_message
if decrypted (encrypt(mymessage, key) , key ) == mymessage:
print "it works"
else:
print "somthing failed"

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
According to alisa miller foreign news bureaus
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
What are the 12 colors of the spectrum called?
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
You know the right answer?
Use the instructor provided xor code to implement a scheme that allows you to encrypt and decrypt so...
Questions