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, 21.06.2019 21:00
The mode is generally used when delivering a presentation to an need now
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
You know the right answer?
Use the instructor provided xor code to implement a scheme that allows you to encrypt and decrypt so...
Questions
question
Mathematics, 04.02.2020 02:00
question
Biology, 04.02.2020 02:00
question
Geography, 04.02.2020 02:00
Questions on the website: 13722362