def sbxor(a: bytearray, k: int) -> bytearray:
    """Calculate the single byte xor a ^ k

    Arguments:
        a {bytearray} -- Bytearray to be xor'd with
        k {int} -- single byte key to test

    Returns:
        bytearray -- a ^ k
    """
    assert(k < 0x100 and k >= 0x0), "k must be a single byte"

    n = bytearray(len(a))
    for i in range(len(a)):
        n[i] = a[i] ^ k
    return n