<jupyter_start><jupyter_text>Secret Sharing between Two Parties - Alice and <NAME>ets build a circuit to represent the secret sharing scheme that we saw in the Quantum Cryptography lectures. Suppose that we allow the user to enter a 2 bit string (i.e one of 00, 01, 10, 11). Based on this we will define a Bell-state for a 2-qubit quantum circuit.<jupyter_code>## SETUP_BELL_STATE(QuantumCircuit, [0, 1, 2, 3])
## sets up the bell state w.r.t. the inputed secret.
def setup_bell_state(qc, secret) :
    qc.h(0)
    qc.cx(0, 1)
    
    # if secret == 0 : (do nothing)
    if secret == 1 :
        qc.z(1)
    elif secret == 2 :
        qc.x(1)
    elif secret == 3 :
        qc.x(1)
        qc.z(1)
    return qc<jupyter_output><empty_output><jupyter_text>The circuit is setup below and the user can enter whatever secret they so desire as long as it is $$ 0 \leq s \leq 3 $$<jupyter_code>circ = QuantumCircuit(2, 2)
secret = 2 # CHANGE THIS IF YOU WANT A DIFFERENT BELL STATE
setup_bell_state(circ, secret)
circ.draw('mpl')
svSim = Aer.get_backend('statevector_simulator')
finalState = execute(circ, backend = svSim).result().get_statevector()
array_to_latex(finalState, pretext="\\text{Statevector = }")<jupyter_output><empty_output><jupyter_text>You can verify from the above statevector that the function does in fact produce the correct Bell states.<jupyter_code>circ.measure([0, 1], [0, 1])
circ.draw("mpl")
nativeSim = Aer.get_backend('qasm_simulator')
result = execute(circ, backend = nativeSim, shots = 1024).result()
plot_histogram(result.get_counts())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11243718592964824, 'fraction_numerical': 0.02386934673366834, 'mean_word_length': 4.363636363636363, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '404392', 'license': 'Apache-2.0', 'n_tokens_mistral': 578, 'n_tokens_neox': 526, 'n_words': 177, 'path': 'Secret Sharing/Secret Sharing.ipynb', 'repo_name': 'LordVader31/QOptimization', 'size': '1591'}