21 lines
501 B
Python
21 lines
501 B
Python
def main():
|
|
shift = (ord('C') - ord('y')) % 26
|
|
|
|
ctext = "XVIEWYWI"
|
|
plaintext = ""
|
|
|
|
for char in ctext:
|
|
if char.isalpha():
|
|
shifted = ord(char.lower()) - shift
|
|
if shifted < ord('a'):
|
|
shifted += 26
|
|
plaintext += chr(shifted)
|
|
else:
|
|
plaintext += char
|
|
|
|
print(f"Attack type: Known plaintext attack")
|
|
print(f"Ciphertext: {ctext}")
|
|
print(f"Decrypted: {plaintext}")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|