code: 
  
  
  import os
  import sys
  
  from . import rsa_key_generator as rkg
  
  lowercase_								=    1_28
  lowercase_								=    2_56
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase = DEFAULT_BLOCK_SIZE				)    ->  list[int]:
  						_a     =			message.encode('ascii'				)
  
  						_a     =			[]
  						for block_start in range(0							,     len(_UpperCAmelCase				)							,     _UpperCAmelCase				):
  												_a     =			0
  												for i in range(_UpperCAmelCase							,     min(block_start + block_size							,     len(_UpperCAmelCase				)				)				):
  																		block_int += message_bytes[i] * (BYTE_SIZE ** (i % block_size))
  												block_ints.append(_UpperCAmelCase				)
  						return block_ints
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase = DEFAULT_BLOCK_SIZE				)    ->  str:
  						_a     =			[]
  						for block_int in block_ints:
  												_a     =			[]
  												for i in range(block_size - 1							,     -1							,     -1				):
  																		if len(_UpperCAmelCase				) + i < message_length:
  																								_a     =			block_int // (BYTE_SIZE**i)
  																								_a     =			block_int % (BYTE_SIZE**i)
  																								block_message.insert(0							,     chr(_UpperCAmelCase				)				)
  												message.extend(_UpperCAmelCase				)
  						return "".join(_UpperCAmelCase				)
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase = DEFAULT_BLOCK_SIZE				)    ->  list[int]:
  						_a     =			[]
  						_a ,	_a     =			key
  
  						for block in get_blocks_from_text(_UpperCAmelCase							,     _UpperCAmelCase				):
  												encrypted_blocks.append(pow(_UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase				)				)
  						return encrypted_blocks
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase = DEFAULT_BLOCK_SIZE							,     )    ->  str:
  						_a     =			[]
  						_a ,	_a     =			key
  						for block in encrypted_blocks:
  												decrypted_blocks.append(pow(_UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase				)				)
  						return get_text_from_blocks(_UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase				)
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  tuple[int, int, int]:
  						with open(_UpperCAmelCase				) as fo:
  												_a     =			fo.read()
  						_a ,	_a ,	_a     =			content.split(','				)
  						return (int(_UpperCAmelCase				), int(_UpperCAmelCase				), int(_UpperCAmelCase				))
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase = DEFAULT_BLOCK_SIZE							,     )    ->  str:
  						_a ,	_a ,	_a     =			read_key_file(_UpperCAmelCase				)
  						if key_size < block_size * 8:
  												sys.exit(
  												    'ERROR: Block size is {} bits and key size is {} bits. The RSA cipher '
  												    'requires the block size to be equal to or greater than the key size. '
  												    'Either decrease the block size or use different keys.'.format(
  												        block_size * 8							,     _UpperCAmelCase				)				)
  
  						_a     =			[str(_UpperCAmelCase				) for i in encrypt_message(_UpperCAmelCase							,     (n, e)							,     _UpperCAmelCase				)]
  
  						_a     =			','.join(_UpperCAmelCase				)
  						_a     =			f"""{len(_UpperCAmelCase				)}_{block_size}_{encrypted_content}"""
  						with open(_UpperCAmelCase							,     'w'				) as fo:
  												fo.write(_UpperCAmelCase				)
  						return encrypted_content
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase				)    ->  str:
  						_a ,	_a ,	_a     =			read_key_file(_UpperCAmelCase				)
  						with open(_UpperCAmelCase				) as fo:
  												_a     =			fo.read()
  						_a ,	_a ,	_a     =			content.split('_'				)
  						_a     =			int(_UpperCAmelCase				)
  						_a     =			int(_UpperCAmelCase				)
  
  						if key_size < block_size * 8:
  												sys.exit(
  												    'ERROR: Block size is {} bits and key size is {} bits. The RSA cipher '
  												    'requires the block size to be equal to or greater than the key size. '
  												    'Did you specify the correct key file and encrypted file?'.format(
  												        block_size * 8							,     _UpperCAmelCase				)				)
  
  						_a     =			[]
  						for block in encrypted_message.split(','				):
  												encrypted_blocks.append(int(_UpperCAmelCase				)				)
  
  						return decrypt_message(_UpperCAmelCase							,     _UpperCAmelCase							,     (n, d)							,     _UpperCAmelCase				)
  
  
  def 							SCREAMING_SNAKE_CASE					(  )    ->  None:
  						_a     =			'encrypted_file.txt'
  						_a     =			input(R'Encrypt\Decrypt [e\d]: '				)
  
  						if response.lower().startswith('e'				):
  												_a     =			'encrypt'
  						elif response.lower().startswith('d'				):
  												_a     =			'decrypt'
  
  						if mode == "encrypt":
  												if not os.path.exists('rsa_pubkey.txt'				):
  																		rkg.make_key_files('rsa'							,     1024				)
  
  												_a     =			input('\nEnter message: '				)
  												_a     =			'rsa_pubkey.txt'
  												print(f"""Encrypting and writing to {filename}..."""				)
  												_a     =			encrypt_and_write_to_file(_UpperCAmelCase							,     _UpperCAmelCase							,     _UpperCAmelCase				)
  
  												print('\nEncrypted text:'				)
  												print(_UpperCAmelCase				)
  
  						elif mode == "decrypt":
  												_a     =			'rsa_privkey.txt'
  												print(f"""Reading from {filename} and decrypting..."""				)
  												_a     =			read_from_file_and_decrypt(_UpperCAmelCase							,     _UpperCAmelCase				)
  												print('writing decryption to rsa_decryption.txt...'				)
  												with open('rsa_decryption.txt'							,     'w'				) as dec:
  																		dec.write(_UpperCAmelCase				)
  
  												print('\nDecryption:'				)
  												print(_UpperCAmelCase				)
  
  
  if __name__ == "__main__":
  		main()
  
  
style_context: 
  
  
  lowercase_								=    [0.485, 0.456, 0.406]
  lowercase_								=    [0.229, 0.224, 0.225]
  lowercase_								=    [0.5, 0.5, 0.5]
  lowercase_								=    [0.5, 0.5, 0.5]
  lowercase_								=    [0.48145466, 0.4578275, 0.40821073]
  lowercase_								=    [0.26862954, 0.26130258, 0.27577711]
  
  
  