def xor_key(data, avoid='\x00\n', size=None):
 size = (size or context.bytes)
 if (len(data) % size):
  log.error('Data must be padded to size for xor_key')
 words = lists.group(size, data)
 columns = ([''] * size)
 for word in words:
  for (i, byte) in enumerate(word):
   columns[i] += byte
 alphabet = list((chr(n) for n in range(256) if (chr(n) not in avoid)))
 result = ''
 for column in columns:
  if context.randomize:
   random.shuffle(alphabet)
  for c2 in alphabet:
   if all(((chr((ord(c) ^ ord(c2))) in alphabet) for c in column)):
    result += c2
    break
  else:
   return None
 return (result, xor(data, result))

def xor_key ( data , avoid = '\x00\n' , size = None ) : size = ( size or context . bytes ) if ( len ( data ) % size ) : log . error ( 'Data must be padded to size for xor_key' ) words = lists . group ( size , data ) columns = ( [ '' ] * size ) for word in words : for ( i , byte ) in enumerate ( word ) : columns [ i ] += byte alphabet = list ( ( chr ( n ) for n in range ( 256 ) if ( chr ( n ) not in avoid ) ) ) result = '' for column in columns : if context . randomize : random . shuffle ( alphabet ) for c2 in alphabet : if all ( ( ( chr ( ( ord ( c ) ^ ord ( c2 ) ) ) in alphabet ) for c in column ) ) : result += c2 break else : return None return ( result , xor ( data , result ) )
xor_key -> none or finds a size-width value that can be xored with a string to produce data .