def xor(a: bytes, b: bytes, repeat: bool = False) -> bytes:
    """XORs two byte strings

    Parameters:
        a, b: bytes
            byte strings to XOR
        
    Returns:
        result: bytes
            XOR result
    """

    if repeat: iterations = max(len(a), len(b))
    else: iterations = min(len(a), len(b))

    result = b""
    for i in range(iterations):
        result += bytes([a[i % len(a)] ^ b[i % len(b)]])
    
    return result