@@ -76,11 +76,9 @@ def encrypt_and_write_to_file(
76
76
key_size , n , e = read_key_file (key_filename )
77
77
if key_size < block_size * 8 :
78
78
sys .exit (
79
- "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
80
- "requires the block size to be equal to or greater than the key size. "
81
- "Either decrease the block size or use different keys." .format (
82
- block_size * 8 , key_size
83
- )
79
+ f"ERROR: Block size is { block_size * 8 } bits and key size is { key_size } "
80
+ "bits. The RSA cipher requires the block size to be equal to or greater "
81
+ "than the key size. Either decrease the block size or use different keys."
84
82
)
85
83
86
84
encrypted_blocks = [str (i ) for i in encrypt_message (message , (n , e ), block_size )]
@@ -102,11 +100,9 @@ def read_from_file_and_decrypt(message_filename: str, key_filename: str) -> str:
102
100
103
101
if key_size < block_size * 8 :
104
102
sys .exit (
105
- "ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
106
- "requires the block size to be equal to or greater than the key size. "
107
- "Did you specify the correct key file and encrypted file?" .format (
108
- block_size * 8 , key_size
109
- )
103
+ f"ERROR: Block size is { block_size * 8 } bits and key size is { key_size } "
104
+ "bits. The RSA cipher requires the block size to be equal to or greater "
105
+ "than the key size. Were the correct key file and encrypted file specified?"
110
106
)
111
107
112
108
encrypted_blocks = []
0 commit comments