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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 04:00, coolconnor1234p0sv4p
Another name for addicting games. com
Answers: 1
image
Computers and Technology, 23.06.2019 11:50, itaheart101
While preforming before operation pmcs, you notice the front right tire appears slightly under-inflated. what is the proper action?
Answers: 3
image
Computers and Technology, 23.06.2019 14:00, allison9746
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
image
Computers and Technology, 24.06.2019 00:10, roxymiller3942
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
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 in other subjects:

Konu
Mathematics, 20.10.2019 04:10
Konu
History, 20.10.2019 04:10