def xor(text, key):
    """Returns the given string XORed with given key."""
    while len(key) < len(text): key += key
    key = key[:len(text)]
    return "".join(chr(ord(a) ^ ord(b)) for (a, b) in zip(text, key))