Subsi
Category: Cryptography
50 points
cipher : HITSS{5X65Z1ZXZ10F_E1LI3J}
file: script.py
script.py
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ{}_1234567890'
key = 'QWERTPOIUYASDFGLKJHZXCVMNB{}_1234567890'
text = <flag>
def encrypter(text,key):
encrypted_msg = ''
for i in text:
index = alpha.index(i)
encrypted_msg += key[index]
# print(encrypted_msg)
return encrypted_msg
Solution
It’s a classic substitution cipher, so I’ve made small change in given Python script to parametrize the alpha and used alpha as key and key as alpha.
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ{}_1234567890'
key = 'QWERTPOIUYASDFGLKJHZXCVMNB{}_1234567890'
encrypted_flag = 'HITSS{5X65Z1ZXZ10F_E1LI3J}'
def encrypter(text, key, alpha):
encrypted_msg = ''
for i in text:
index = alpha.index(i)
encrypted_msg += key[index]
return encrypted_msg
print(encrypter(encrypted_flag, alpha, key))
Output:
SHELL{5U65T1TUT10N_C1PH3R}
Flag
SHELL{5U65T1TUT10N_C1PH3R}