Kleptography
This commit is contained in:
13
kleptography.py
Normal file
13
kleptography.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
n, m = map(int, input().split())
|
||||||
|
knowntext = input()
|
||||||
|
ciphertext = input()
|
||||||
|
plaintext = [""] * m
|
||||||
|
for i in range(n):
|
||||||
|
plaintext[-n + i] = knowntext[i]
|
||||||
|
|
||||||
|
for i in range(m - 1, -1, -1):
|
||||||
|
char = chr((ord(ciphertext[i]) - ord(plaintext[i])) % 26 + 97)
|
||||||
|
if i - n >= 0:
|
||||||
|
plaintext[i - n] = char
|
||||||
|
|
||||||
|
print("".join(plaintext))
|
||||||
Reference in New Issue
Block a user