def cypher(msg, key):
    """ Encrypts or decyrpts the supplied plaintext using the given key.
    Arguments:
    msg -- The string message to be passed throught the cypher.
    key -- The key, byte array, used to encrypt/decrypt the message.

    Returns:
    The encrypted message.
    
    Raises:
    Exception -- The binary length of the key and message don't match. 
    """
    size = len(msg)
    if (len(key) != size): raise Exception("Invalid key length")

    return "".join([chr(ord(msg[i]) ^ key[i]) for i in range(0, size)])