def get_prefix_length(oracle):
    """Finds the length of the prefix that mysterious_encrypt adds to the plaintext before encrypting."""
    # Encrypt two different ciphertexts
    ciphertext_a = oracle.encrypt(b'A')
    ciphertext_b = oracle.encrypt(b'B')

    # Since the stream ciphers encrypts bit by bit, the prefix length will be equal to
    # the number of bytes that are equal in the two ciphertext.
    prefix_length = 0
    while ciphertext_a[prefix_length] == ciphertext_b[prefix_length]:
        prefix_length += 1

    return prefix_length