generated from mwc/lab_encryption
Completed checkpoint 4 and added a dictionary txt
This commit is contained in:
parent
f5f3335453
commit
6ce564f821
22
ccipher.py
22
ccipher.py
|
@ -41,4 +41,24 @@ def decrypt(numeric_message):
|
|||
for item in numeric_message:
|
||||
to_decrypt.append((item + (256 - secret_number)) % 256)
|
||||
return to_decrypt
|
||||
print(decrypt(encrypt(numerify('abc'))))
|
||||
print(decrypt(encrypt(numerify('abc'))))
|
||||
|
||||
# Checkpoint 4
|
||||
|
||||
def wordify(decrypted_message):
|
||||
word = []
|
||||
for items in decrypted_message:
|
||||
word.append(chr(items))
|
||||
return ''.join(word)
|
||||
|
||||
print(wordify(decrypt(encrypt(numerify('abc')))))
|
||||
|
||||
secret_number = 78
|
||||
|
||||
message = open('xfile.txt','r').read().replace('[','').replace(']','').split(',')
|
||||
# Is this how I was supposed to get the list from the file?
|
||||
message_copy = []
|
||||
for item in message:
|
||||
message_copy.append(int(item))
|
||||
message_copy=wordify(decrypt(message_copy))
|
||||
print(message_copy)
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue