#NEWLINE# def decrypt( self , ciphertext ) : #NEWLINE# #INDENT# if ( ( len ( ciphertext ) % self . _segment_bytes ) != 0 ) : #NEWLINE# #INDENT# raise ValueError ( 'ciphertext block must be a multiple of segment_size' ) #NEWLINE# #UNINDENT# ciphertext = _string_to_bytes ( ciphertext ) #NEWLINE# decrypted = [ ] #NEWLINE# for i in xrange ( 0 , len ( ciphertext ) , self . _segment_bytes ) : #NEWLINE# #INDENT# cipher_segment = ciphertext [ i : ( i + self . _segment_bytes ) ] #NEWLINE# xor_segment = self . _aes . encrypt ( self . _shift_register ) [ : len ( cipher_segment ) ] #NEWLINE# plaintext_segment = [ ( p ^ x ) for ( p , x ) in zip ( cipher_segment , xor_segment ) ] #NEWLINE# self . _shift_register = _concat_list ( self . _shift_register [ len ( cipher_segment ) : ] , cipher_segment ) #NEWLINE# decrypted . extend ( plaintext_segment ) #NEWLINE# #UNINDENT# return _bytes_to_string ( decrypted )