def __init__(
		self, key_size, block_cipher_mode, init_sequence, padding=None
	):
		""" Create new AES-mode.

		:param key_size: secret length
		:param block_cipher_mode: name of block cipher mode of operation
		:param padding: padding object (if required)
		:param init_sequence: AES secret with initialization vector or counter value
		"""
		self.__key_size = key_size
		self.__mode = block_cipher_mode
		self.__padding = padding
		self.__sequence_chopper = WAESMode.SequenceChopper(key_size, block_cipher_mode, init_sequence)

		if block_cipher_mode == 'AES-CBC':
			mode_code = modes.CBC(self.__sequence_chopper.initialization_vector())
		elif block_cipher_mode == 'AES-CTR':
			mode_code = modes.CTR(self.__sequence_chopper.initialization_counter_value())
		else:
			raise ValueError('Unknown block cipher mode spotted')

		self.__cipher_args = (AES(self.__sequence_chopper.secret()), mode_code)
		self.__cipher_kwargs = {'backend': default_backend()}
def __init__ ( self , key_size , block_cipher_mode , init_sequence , padding = None ) : self . __key_size = key_size self . __mode = block_cipher_mode self . __padding = padding self . __sequence_chopper = WAESMode . SequenceChopper ( key_size , block_cipher_mode , init_sequence ) if block_cipher_mode == 'AES-CBC' : mode_code = modes . CBC ( self . __sequence_chopper . initialization_vector ( ) ) elif block_cipher_mode == 'AES-CTR' : mode_code = modes . CTR ( self . __sequence_chopper . initialization_counter_value ( ) ) else : raise ValueError ( 'Unknown block cipher mode spotted' ) self . __cipher_args = ( AES ( self . __sequence_chopper . secret ( ) ) , mode_code ) self . __cipher_kwargs = { 'backend' : default_backend ( ) }
Create new AES-mode.

		:param key_size: secret length
		:param block_cipher_mode: name of block cipher mode of operation
		:param padding: padding object (if required)
		:param init_sequence: AES secret with initialization vector or counter value