def repeating_key(bs, key):
    """
    Implementation of repeating-key XOR.
    """
    # XOR each byte of the byte array with its appropriate key byte.
    return bytearray([bs[i] ^ key[i%len(key)] for i in range(len(bs))])