def _create_cfb_cipher(factory, **kwargs):
 cipher_state = factory._create_base_cipher(kwargs)
 iv = kwargs.pop('IV', None)
 IV = kwargs.pop('iv', None)
 if ((None, None) == (iv, IV)):
  iv = get_random_bytes(factory.block_size)
 if (iv is not None):
  if (IV is not None):
   raise TypeError("You must either use 'iv' or 'IV', not both")
 else:
  iv = IV
 (segment_size_bytes, rem) = divmod(kwargs.pop('segment_size', 8), 8)
 if ((segment_size_bytes == 0) or (rem != 0)):
  raise ValueError("'segment_size' must be positive and multiple of 8 bits")
 if kwargs:
  raise TypeError(('Unknown parameters for CFB: %s' % str(kwargs)))
 return CfbMode(cipher_state, iv, segment_size_bytes)

def _create_cfb_cipher ( factory , ** kwargs ) : cipher_state = factory . _create_base_cipher ( kwargs ) iv = kwargs . pop ( 'IV' , None ) IV = kwargs . pop ( 'iv' , None ) if ( ( None , None ) == ( iv , IV ) ) : iv = get_random_bytes ( factory . block_size ) if ( iv is not None ) : if ( IV is not None ) : raise TypeError ( "You must either use 'iv' or 'IV', not both" ) else : iv = IV ( segment_size_bytes , rem ) = divmod ( kwargs . pop ( 'segment_size' , 8 ) , 8 ) if ( ( segment_size_bytes == 0 ) or ( rem != 0 ) ) : raise ValueError ( "'segment_size' must be positive and multiple of 8 bits" ) if kwargs : raise TypeError ( ( 'Unknown parameters for CFB: %s' % str ( kwargs ) ) ) return CfbMode ( cipher_state , iv , segment_size_bytes )
instantiate a cipher object that performs cfb encryption/decryption .