def call_cipher(self): """ Calls the cipher selected by the user. Encrypts using the selected cipher then encrypts that cipher text with a one time pad. Decrypts the otp first then passes the result to the selected cipher for decryption. Cipher text is output in uppercase, decrypted plain text is output in lowercase. """ if self.cipher_choice == "affine": if self.crypt == "encrypt": encrypted_message = Affine().encrypt(self.message.upper()) otp_encrypted = OneTimePad().encrypt(encrypted_message, self.otp.upper()) return (otp_encrypted) elif self.crypt == "decrypt": otp_decrypted = OneTimePad().decrypt(self.message.upper(), self.otp.upper()) decrypted_message = Affine().decrypt(otp_decrypted) return (decrypted_message.lower()) elif self.cipher_choice == "atbash": if self.crypt == "encrypt": encrypted_message = Atbash().encrypt(self.message.upper()) otp_encrypted = OneTimePad().encrypt(encrypted_message, self.otp.upper()) return (otp_encrypted) elif self.crypt == "decrypt": otp_decrypted = OneTimePad().decrypt(self.message.upper(), self.otp.upper()) decrypted_message = Atbash().decrypt(otp_decrypted) return (decrypted_message.lower()) elif self.cipher_choice == "keyword": if self.crypt == "encrypt": encrypted_message = KeywordCipher().encrypt( self.message.upper()) otp_encrypted = OneTimePad().encrypt(encrypted_message, self.otp.upper()) return (otp_encrypted) elif self.crypt == "decrypt": otp_decrypted = OneTimePad().decrypt(self.message.upper(), self.otp.upper()) decrypted_message = KeywordCipher().decrypt(otp_decrypted) return (decrypted_message.lower())