def xor(buf, key):
 encrypted = []
 for (i, cr) in enumerate(buf):
  k = key[(i % len(key))]
  encrypted += [(cr ^ k)]
 return bytes(encrypted)

def xor ( buf , key ) : encrypted = [ ] for ( i , cr ) in enumerate ( buf ) : k = key [ ( i % len ( key ) ) ] encrypted += [ ( cr ^ k ) ] return bytes ( encrypted )
xor two strings .