In: Computer Science
message = 'youcannotdecodemyciphertexttoday'
def transposition_cipher_encode(plain_text, key):
# the input, key should be a permutation of integers 0 to some
number
# your code here
return
need code in PYTHON
def transposition_cipher_encode(plain_text,key):
data={int(v): n for n, v in enumerate(key)}
cipher_text = ''
for index in sorted(data.keys()):
for s in [plain_text[i:i + len(key)] for i in range(0, len(plain_text), len(key))]:
try:
cipher_text =cipher_text+s[data[index]]
except:
continue
return cipher_text
message = 'youcannotdecodemyciphertexttoday'
key="12564"
print(transposition_cipher_encode(message,key))