Modified Lab 1 IS

This commit is contained in:
sherlock 2025-08-05 07:23:18 +05:30
parent fdc634b589
commit 933a52b3a8
8 changed files with 166 additions and 384 deletions

View file

@ -0,0 +1,21 @@
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()