generated from mwc/lab_encryption
Completed checkpoints 1-4
This commit is contained in:
parent
e02fce2381
commit
da89c5ba21
39
ccipher.py
39
ccipher.py
|
@ -16,4 +16,41 @@ hex_lst=[]
|
|||
for item in encoded_lst:
|
||||
hex_lst.append(list(item)[0])
|
||||
print("The hex values associated with those bytes is:")
|
||||
print(hex_lst)
|
||||
print(hex_lst)
|
||||
|
||||
def numerify(message):
|
||||
if len(message) == 0:
|
||||
return []
|
||||
else:
|
||||
bytes_list = []
|
||||
for char in message:
|
||||
bytes_list.append(bytes(char,'utf-8'))
|
||||
encoded = []
|
||||
for byte in bytes_list:
|
||||
encoded.append(list(byte)[0])
|
||||
return encoded
|
||||
|
||||
print(numerify('abc'))
|
||||
|
||||
secret_number = 1
|
||||
|
||||
def encrypt(numeric_message):
|
||||
encrypted_list = []
|
||||
for num in numeric_message:
|
||||
encrypted_list.append((num + secret_number) % 256)
|
||||
return encrypted_list
|
||||
|
||||
print(encrypt(numerify('abc')))
|
||||
|
||||
def wordify(decrypted_message):
|
||||
char_list = []
|
||||
for byte in decrypted_message:
|
||||
char_list.append(chr(byte))
|
||||
words = ''.join(char_list)
|
||||
return words
|
||||
|
||||
xfile = [155, 192, 193, 124, 110, 148, 179, 192, 192, 175, 192, 193, 110, 178, 183, 179, 178, 110, 189, 188, 110, 194, 182, 179, 110, 188, 183, 181, 182, 194, 110, 189, 180, 110, 194, 182, 179, 110, 127, 132, 194, 182, 110, 123, 110, 127, 133, 194, 182, 110, 161, 179, 190, 194, 179, 187, 176, 179, 192, 48, 175, 110, 162, 182, 195, 192, 193, 178, 175, 199, 124, 110, 151, 110, 197, 175, 193, 110, 193, 179, 188, 194, 110, 180, 189, 192, 110, 175, 194, 110, 179, 183, 181, 182, 194, 110, 189, 177, 186, 189, 177, 185, 110, 189, 188, 110, 194, 182, 179, 110, 187, 189, 192, 188, 183, 188, 181, 110, 189, 180, 110, 148, 192, 183, 178, 175, 199, 110, 194, 182, 179, 110, 127, 133, 194, 182, 124, 110, 162, 182, 179, 192, 179, 110, 197, 175, 193, 110, 188, 189, 194, 182, 183, 188, 181, 110, 194, 189, 110, 176, 179, 110, 178, 189, 188, 179, 124, 110, 161, 182, 179, 110, 182, 175, 178, 110, 176, 179, 179, 188, 110, 178, 179, 175, 178, 110, 193, 189, 187, 179, 110, 182, 189, 195, 192, 193, 124, 110, 151, 194, 110, 197, 175, 193, 110, 184, 195, 193, 194, 110, 175, 110, 180, 179, 197, 110, 187, 183, 188, 195, 194, 179, 193, 110, 175, 180, 194, 179, 192, 110, 188, 183, 188, 179, 110, 197, 182, 179, 188, 110, 151, 110, 192, 179, 175, 177, 182, 179, 178, 110, 182, 189, 187, 179, 110, 189, 188, 177, 179, 110, 187, 189, 192, 179, 124, 110, 151, 110, 189, 190, 179, 188, 179, 178, 110, 194, 182, 179, 110, 180, 192, 189, 188, 194, 110, 178, 189, 189, 192, 110, 197, 183, 194, 182, 110, 187, 199, 110, 186, 175, 194, 177, 182, 123, 185, 179, 199, 122, 110, 175, 188, 178, 110, 190, 195, 192, 190, 189, 193, 179, 186, 199, 110, 178, 179, 186, 175, 199, 179, 178, 110, 175, 110, 180, 179, 197, 110, 187, 189, 187, 179, 188, 194, 193, 110, 183, 188, 110, 194, 182, 179, 110, 182, 175, 186, 186, 122, 110, 182, 175, 188, 181, 183, 188, 181, 110, 195, 190, 110, 187, 199, 110, 182, 175, 194, 110, 175, 188, 178, 110, 194, 182, 179, 110, 186, 183, 181, 182, 194, 110, 189, 196, 179, 192, 177, 189, 175, 194, 110, 194, 182, 175, 194, 110, 151, 110, 182, 175, 178, 110, 178, 179, 179, 187, 179, 178, 110, 175, 110, 197, 183, 193, 179, 110, 190, 192, 179, 177, 175, 195, 194, 183, 189, 188, 110, 175, 181, 175, 183, 188, 193, 194, 110, 194, 182, 179, 110, 177, 182, 183, 186, 186, 110, 189, 180, 110, 175, 188, 110, 179, 175, 192, 186, 199, 110, 175, 195, 194, 195, 187, 188, 110, 187, 189, 192, 188, 183, 188, 181, 124, 110, 162, 189, 110, 194, 179, 186, 186, 110, 194, 182, 179, 110, 194, 192, 195, 194, 182, 122, 110, 151, 110, 197, 175, 193, 110, 177, 189, 188, 193, 183, 178, 179, 192, 175, 176, 186, 199, 110, 195, 190, 193, 179, 194, 110, 175, 188, 178, 110, 197, 189, 192, 192, 183, 179, 178, 124, 110, 151, 110, 175, 187, 110, 188, 189, 194, 110, 181, 189, 183, 188, 181, 110, 194, 189, 110, 190, 192, 179, 194, 179, 188, 178, 110, 194, 182, 175, 194, 110, 175, 194, 110, 194, 182, 175, 194, 110, 187, 189, 187, 179, 188, 194, 110, 151, 110, 180, 189, 192, 179, 193, 175, 197, 110, 194, 182, 179, 110, 179, 196, 179, 188, 194, 193, 110, 189, 180, 110, 194, 182, 179, 110, 188, 179, 198, 194, 110, 180, 179, 197, 110, 197, 179, 179, 185, 193, 124, 110, 151, 110, 179, 187, 190, 182, 175, 194, 183, 177, 175, 186, 186, 199, 110, 178, 183, 178, 110, 188, 189, 194, 110, 178, 189, 110, 193, 189, 124, 110, 144, 195, 194, 110, 187, 199, 110, 183, 188, 193, 194, 183, 188, 177, 194, 110, 194, 189, 186, 178, 110, 187, 179, 110, 194, 182, 175, 194, 110, 194, 182, 179, 192, 179, 110, 197, 179, 192, 179, 110, 193, 194, 183, 192, 192, 183, 188, 181, 110, 194, 183, 187, 179, 193, 110, 175, 182, 179, 175, 178, 124, 110, 148, 192, 189, 187, 110, 194, 182, 179, 110, 178, 183, 188, 183, 188, 181, 123, 192, 189, 189, 187, 110, 189, 188, 110, 187, 199, 110, 186, 179, 180, 194, 110, 194, 182, 179, 192, 179, 110, 177, 175, 187, 179, 110, 194, 182, 179, 110, 192, 175, 194, 194, 186, 179, 110, 189, 180, 110, 194, 179, 175, 123, 177, 195, 190, 193, 110, 175, 188, 178, 110, 194, 182, 179, 110, 193, 182, 189, 192, 194, 122, 110, 178, 192, 199, 110, 177, 189, 195, 181, 182, 110, 189, 180, 110, 187, 199, 110, 193, 183, 193, 194, 179, 192, 110, 145, 175, 192, 189, 186, 183, 188, 179, 124]
|
||||
|
||||
secret_number = -78
|
||||
|
||||
print(wordify(encrypt(xfile)))
|
||||
|
|
Loading…
Reference in New Issue