Modified Lab 1 IS
This commit is contained in:
parent
fdc634b589
commit
933a52b3a8
8 changed files with 166 additions and 384 deletions
|
@ -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()
|
Loading…
Add table
Add a link
Reference in a new issue