def _create_base_cipher(dict_parameters):
 use_aesni = dict_parameters.pop('use_aesni', True)
 try:
  key = dict_parameters.pop('key')
 except KeyError:
  raise TypeError("Missing 'key' parameter")
 expect_byte_string(key)
 if (len(key) not in key_size):
  raise ValueError(('Incorrect AES key length (%d bytes)' % len(key)))
 if (use_aesni and _raw_aesni_lib):
  start_operation = _raw_aesni_lib.AESNI_start_operation
  stop_operation = _raw_aesni_lib.AESNI_stop_operation
 else:
  start_operation = _raw_aes_lib.AES_start_operation
  stop_operation = _raw_aes_lib.AES_stop_operation
 cipher = VoidPointer()
 result = start_operation(key, c_size_t(len(key)), cipher.address_of())
 if result:
  raise ValueError(('Error %X while instantiating the AES cipher' % result))
 return SmartPointer(cipher.get(), stop_operation)

def _create_base_cipher ( dict_parameters ) : use_aesni = dict_parameters . pop ( 'use_aesni' , True ) try : key = dict_parameters . pop ( 'key' ) except KeyError : raise TypeError ( "Missing 'key' parameter" ) expect_byte_string ( key ) if ( len ( key ) not in key_size ) : raise ValueError ( ( 'Incorrect AES key length (%d bytes)' % len ( key ) ) ) if ( use_aesni and _raw_aesni_lib ) : start_operation = _raw_aesni_lib . AESNI_start_operation stop_operation = _raw_aesni_lib . AESNI_stop_operation else : start_operation = _raw_aes_lib . AES_start_operation stop_operation = _raw_aes_lib . AES_stop_operation cipher = VoidPointer ( ) result = start_operation ( key , c_size_t ( len ( key ) ) , cipher . address_of ( ) ) if result : raise ValueError ( ( 'Error %X while instantiating the AES cipher' % result ) ) return SmartPointer ( cipher . get ( ) , stop_operation )
this method instantiates and returns a handle to a low-level base cipher .