{ "cells": [ { "cell_type": "markdown", "id": "ed4630ba", "metadata": { "cq.autogen": "title_cell" }, "source": [ "# Elliptic Curve Cryptography\n", "\n", "Bloqs for breaking elliptic curve cryptography systems via the discrete log.\n", "\n", "Elliptic curve cryptography is a form of public key cryptography based on the finite\n", "field of elliptic curves. For our purposes, we will denote the group operation as addition\n", "(whose definition we will explore later) $A + B$. We will denote repeated addition\n", " as $[k] A = A + \\dots + A$ ($k$ times).\n", "\n", "Within this algebra, the cryptographic scheme relates the public and private keys via\n", "$$\n", "Q = [k] P\n", "$$\n", "for private key $k$, public key $Q$, and a choice of base point $P$. The cryptographic\n", "security comes from the difficulty of inverting the multiplication. I.e. it is difficult\n", "to do a discrete logarithm in this field.\n", "\n", "Using Shor's algorithm for the discrete logarithm, we can find $k$ in polynomial time\n", "with a quantum algorithm." ] }, { "cell_type": "code", "execution_count": 1, "id": "82580882", "metadata": { "cq.autogen": "top_imports" }, "outputs": [], "source": [ "from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", "from qualtran import QBit, QInt, QUInt, QAny\n", "from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", "from typing import *\n", "import numpy as np\n", "import sympy\n", "import cirq" ] }, { "cell_type": "markdown", "id": "60163c9f", "metadata": { "cq.autogen": "FindECCPrivateKey.bloq_doc.md" }, "source": [ "## `FindECCPrivateKey`\n", "Perform two phase estimations to break elliptic curve cryptography.\n", "\n", "This follows the strategy in Litinski 2023. We perform two phase estimations corresponding\n", "to `ECCAddR(R=P)` and `ECCAddR(R=Q)` for base point $P$ and public key $Q$.\n", "\n", "The first phase estimation projects us into a random eigenstate of the ECCAddR(R=P) operator\n", "which we index by the integer $c$. Per eq. 5 in the reference, these eigenstates take the form\n", "$$\n", "|\\psi_c \\rangle = \\sum_j^{r-1} \\omega^{cj}\\ | [j]P \\rangle \\\\\n", "\\omega = e^{2\\pi i / r} \\\\\n", "[r] P = P\n", "$$\n", "\n", "This state is a simultaneous eigenstate of the second operator, `ECCAddR(R=Q)`. By\n", "the definition of the operator, acting it upon $|\\psi_c\\rangle$ gives:\n", "$$\n", "|\\psi_c \\rangle \\rightarrow \\sum_j w^{cj} | [j]P + Q \\rangle\\rangle\n", "$$\n", "\n", "The private key $k$ that we wish to recover relates the public key to the base point\n", "$$\n", "Q = [k] P\n", "$$\n", "so our simultaneous eigenstate can be equivalently written as\n", "$$\n", "\\sum_j^{r-1} \\omega^{cj} | [j+k] P \\rangle \\\\\n", "= \\omega^{-ck} |\\psi_c \\rangle\n", "$$\n", "\n", "Therefore, the measured result of the second phase estimation is $ck$. Since we have\n", "already measured the random index $c$, we can divide it out to recover the private key $k$.\n", "\n", "#### Parameters\n", " - `n`: The bitsize of the elliptic curve points' x and y registers.\n", " - `base_point`: The base point $P$ with unknown order $r$ such that $P = [r] P$.\n", " - `public_key`: The public key $Q$ such that $Q = [k] P$ for private key $k$.\n", " - `add_window_size`: The number of bits in the ECAdd window.\n", " - `mul_window_size`: The number of bits in the modular multiplication window. \n", "\n", "#### References\n", " - [How to compute a 256-bit elliptic curve private key with only 50 million Toffoli gates](https://arxiv.org/abs/2306.08585). Litinski. 2023. Figure 4 (a).\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "92003a1f", "metadata": { "cq.autogen": "FindECCPrivateKey.bloq_doc.py" }, "outputs": [], "source": [ "from qualtran.bloqs.cryptography.ecc import FindECCPrivateKey" ] }, { "cell_type": "code", "execution_count": 3, "id": "6cb48b0a-44c8-40e5-ba1e-d0b3a0745046", "metadata": {}, "outputs": [], "source": [ "from qualtran.bloqs.cryptography.ecc import ECPoint" ] }, { "cell_type": "markdown", "id": "e7c573eb", "metadata": { "cq.autogen": "FindECCPrivateKey.example_instances.md" }, "source": [ "### Example Instances" ] }, { "cell_type": "code", "execution_count": 4, "id": "51f1d2bf", "metadata": { "cq.autogen": "FindECCPrivateKey.ecc" }, "outputs": [], "source": [ "n, p = sympy.symbols('n p')\n", "Px, Py, Qx, Qy = sympy.symbols('P_x P_y Q_x Q_y')\n", "P = ECPoint(Px, Py, mod=p)\n", "Q = ECPoint(Qx, Qy, mod=p)\n", "ecc = FindECCPrivateKey(n=n, base_point=P, public_key=Q)" ] }, { "cell_type": "markdown", "id": "921c0ce8", "metadata": { "cq.autogen": "FindECCPrivateKey.graphical_signature.md" }, "source": [ "#### Graphical Signature" ] }, { "cell_type": "code", "execution_count": 5, "id": "d231c54e", "metadata": { "cq.autogen": "FindECCPrivateKey.graphical_signature.py" }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "1cc52dd232454217abafffb38eb6ed59", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '\n", "\n", "counts\n", "\n", "\n", "\n", "b0\n", "\n", "FindECCPrivateKey\n", "\n", "\n", "\n", "b1\n", "\n", "PE$(_Rx0, _Ry0)$\n", "\n", "\n", "\n", "b0->b1\n", "\n", "\n", "2\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "#### Counts totals:\n", " - `PE$(_Rx0, _Ry0)$`: 2" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from qualtran.resource_counting.generalizers import ignore_split_join\n", "ecc_g, ecc_sigma = ecc.call_graph(max_depth=1, generalizer=ignore_split_join)\n", "show_call_graph(ecc_g)\n", "show_counts_sigma(ecc_sigma)" ] }, { "cell_type": "code", "execution_count": 7, "id": "510c3f43-5a16-4113-95e4-74e4c1618a68", "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "my_graph\n", "\n", "\n", "\n", "ECPhaseEstimateR\n", "\n", "PE$(Q_x, Q_y)$\n", "\n", "x\n", "\n", "y\n", "\n", "\n", "\n", "Free\n", "\n", "Free\n", "\n", "reg\n", "\n", "\n", "\n", "\n", "ECPhaseEstimateR:e->Free:w\n", "\n", "\n", "n\n", "\n", "\n", "\n", "Free_G3\n", "\n", "Free\n", "\n", "reg\n", "\n", "\n", "\n", "\n", "ECPhaseEstimateR:e->Free_G3:w\n", "\n", "\n", "n\n", "\n", "\n", "\n", "ECPhaseEstimateR_G0\n", "\n", "PE$(P_x, P_y)$\n", "\n", "x\n", "\n", "y\n", "\n", "\n", "\n", "ECPhaseEstimateR_G0:e->ECPhaseEstimateR:w\n", "\n", "\n", "n\n", "\n", "\n", "\n", "ECPhaseEstimateR_G0:e->ECPhaseEstimateR:w\n", "\n", "\n", "n\n", "\n", "\n", "\n", "IntState\n", "\n", "|P_x>\n", "\n", "\n", "val\n", "\n", "\n", "\n", "IntState:e->ECPhaseEstimateR_G0:w\n", "\n", "\n", "n\n", "\n", "\n", "\n", "IntState_G5\n", "\n", "|P_y>\n", "\n", "\n", "val\n", "\n", "\n", "\n", "IntState_G5:e->ECPhaseEstimateR_G0:w\n", "\n", "\n", "n\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_bloq(ecc.decompose_bloq())" ] }, { "cell_type": "markdown", "id": "fff25268", "metadata": { "cq.autogen": "ECPhaseEstimateR.bloq_doc.md" }, "source": [ "## `ECPhaseEstimateR`\n", "Perform a single phase estimation of ECAddR for a given point.\n", "\n", "This is used as a subroutine in `FindECCPrivateKey`. First, we phase-estimate the\n", "addition of the base point $P$, then of the public key $Q$.\n", "\n", "When the ellptic curve point addition window size is 1 we use the ECAddR bloq which has it's\n", "own bespoke circuit; when it is greater than 1 we use the windowed circuit which uses\n", "pre-computed classical additions loaded into the circuit.\n", "\n", "#### Parameters\n", " - `n`: The bitsize of the elliptic curve points' x and y registers.\n", " - `point`: The elliptic curve point to phase estimate against.\n", " - `add_window_size`: The number of bits in the ECAdd window.\n", " - `mul_window_size`: The number of bits in the modular multiplication window.\n" ] }, { "cell_type": "code", "execution_count": 8, "id": "5220a4ad", "metadata": { "cq.autogen": "ECPhaseEstimateR.bloq_doc.py" }, "outputs": [], "source": [ "from qualtran.bloqs.cryptography.ecc import ECPhaseEstimateR" ] }, { "cell_type": "markdown", "id": "f3421d38", "metadata": { "cq.autogen": "ECPhaseEstimateR.example_instances.md" }, "source": [ "### Example Instances" ] }, { "cell_type": "code", "execution_count": 9, "id": "17642453", "metadata": { "cq.autogen": "ECPhaseEstimateR.ec_pe" }, "outputs": [], "source": [ "n, p = sympy.symbols('n p')\n", "Rx, Ry = sympy.symbols('R_x R_y')\n", "ec_pe = ECPhaseEstimateR(n=n, point=ECPoint(Rx, Ry, mod=p))" ] }, { "cell_type": "code", "execution_count": 10, "id": "4616d33a", "metadata": { "cq.autogen": "ECPhaseEstimateR.ec_pe_small" }, "outputs": [], "source": [ "n = 3\n", "Rx, Ry, p = sympy.symbols('R_x R_y p')\n", "ec_pe_small = ECPhaseEstimateR(n=n, point=ECPoint(Rx, Ry, mod=p))" ] }, { "cell_type": "markdown", "id": "33824ce4", "metadata": { "cq.autogen": "ECPhaseEstimateR.graphical_signature.md" }, "source": [ "#### Graphical Signature" ] }, { "cell_type": "code", "execution_count": 11, "id": "528b7d0e", "metadata": { "cq.autogen": "ECPhaseEstimateR.graphical_signature.py" }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8df2c5520d5c4107938a7c8254770c55", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '\n", "\n", "counts\n", "\n", "\n", "\n", "b0\n", "\n", "PE$(R_x, R_y)$\n", "\n", "\n", "\n", "b1\n", "\n", "ECAddR\n", "\n", "\n", "\n", "b0->b1\n", "\n", "\n", "⌊n⌋\n", "\n", "\n", "\n", "b2\n", "\n", "MeasureQFT\n", "\n", "\n", "\n", "b0->b2\n", "\n", "\n", "1\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "#### Counts totals:\n", " - `ECAddR`: $\\displaystyle \\left\\lfloor{n}\\right\\rfloor$\n", " - `MeasureQFT`: 1" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from qualtran.resource_counting.generalizers import ignore_split_join\n", "ec_pe_g, ec_pe_sigma = ec_pe.call_graph(max_depth=1, generalizer=ignore_split_join)\n", "show_call_graph(ec_pe_g)\n", "show_counts_sigma(ec_pe_sigma)" ] }, { "cell_type": "markdown", "id": "fe222fde", "metadata": { "cq.autogen": "ECAddR.bloq_doc.md" }, "source": [ "## `ECAddR`\n", "Perform elliptic curve addition of constant `R`.\n", "\n", "Given the constant elliptic curve point $R$ and an input point $A$\n", "factored into the `x` and `y` registers such that $|A\\rangle = |(a_x,a_y)\\rangle$,\n", "this bloq takes\n", "\n", "$$\n", "|A\\rangle \\rightarrow |A+R\\rangle\n", "$$\n", "\n", "#### Parameters\n", " - `n`: The bitsize of the two registers storing the elliptic curve point.\n", " - `R`: The elliptic curve point to add. \n", "\n", "#### Registers\n", " - `ctrl`: A control bit.\n", " - `x`: The x component of the input elliptic curve point of bitsize `n`.\n", " - `y`: The y component of the input elliptic curve point of bitsize `n`. \n", "\n", "#### References\n", " - [How to compute a 256-bit elliptic curve private key with only 50 million Toffoli gates](https://arxiv.org/abs/2306.08585). Litinski. 2023. Section 1, eq. (3) and (4).\n", " - [Quantum resource estimates for computing elliptic curve discrete logarithms](https://arxiv.org/abs/1706.06752). Roetteler et al. 2017. Algorithm 1 and Figure 10.\n", " - [Microsoft Quantum Crypto (GitHub)](https://github.com/microsoft/QuantumEllipticCurves/blob/dbf4836afaf7a9fab813cbc0970e65af85a6f93a/MicrosoftQuantumCrypto/EllipticCurves.qs#L456). Jaques et al. 2020. `DistinctEllipticCurveClassicalPointAddition`.\n" ] }, { "cell_type": "code", "execution_count": 13, "id": "757bfce9", "metadata": { "cq.autogen": "ECAddR.bloq_doc.py" }, "outputs": [], "source": [ "from qualtran.bloqs.cryptography.ecc import ECAddR" ] }, { "cell_type": "markdown", "id": "999b9be2", "metadata": { "cq.autogen": "ECAddR.example_instances.md" }, "source": [ "### Example Instances" ] }, { "cell_type": "code", "execution_count": 14, "id": "2336e803", "metadata": { "cq.autogen": "ECAddR.ec_add_r" }, "outputs": [], "source": [ "n, p, Rx, Ry = sympy.symbols('n p R_x R_y')\n", "ec_add_r = ECAddR(n=n, R=ECPoint(Rx, Ry, mod=p))" ] }, { "cell_type": "code", "execution_count": 15, "id": "322c447d", "metadata": { "cq.autogen": "ECAddR.ec_add_r_small" }, "outputs": [], "source": [ "n = 5 # fits our mod = 17\n", "P = ECPoint(15, 13, mod=17, curve_a=0)\n", "ec_add_r_small = ECAddR(n=n, R=P)" ] }, { "cell_type": "markdown", "id": "abe24e4e", "metadata": { "cq.autogen": "ECAddR.graphical_signature.md" }, "source": [ "#### Graphical Signature" ] }, { "cell_type": "code", "execution_count": 16, "id": "5422be2d", "metadata": { "cq.autogen": "ECAddR.graphical_signature.py" }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b05d9f14de2a43c48cf01e87c7f72abe", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '\n", "\n", "counts\n", "\n", "\n", "\n", "b0\n", "\n", "ECAddR\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "#### Counts totals:\n", " - `ECAddR`: 1" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from qualtran.resource_counting.generalizers import ignore_split_join\n", "ec_add_r_g, ec_add_r_sigma = ec_add_r.call_graph(max_depth=1, generalizer=ignore_split_join)\n", "show_call_graph(ec_add_r_g)\n", "show_counts_sigma(ec_add_r_sigma)" ] }, { "cell_type": "code", "execution_count": 18, "id": "35d9dc15-7a16-4aeb-9f1a-a5e7a14461ba", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+[ 1] P -> ( 2, 10)\n", "+[ 2] P -> ( 8, 3)\n", "+[ 3] P -> (12, 1)\n", "+[ 4] P -> ( 6, 6)\n", "+[ 5] P -> ( 5, 8)\n", "+[ 6] P -> (10, 15)\n", "+[ 7] P -> ( 1, 12)\n", "+[ 8] P -> ( 3, 0)\n", "+[ 9] P -> ( 1, 5)\n", "+[10] P -> (10, 2)\n", "+[11] P -> ( 5, 9)\n", "+[12] P -> ( 6, 11)\n", "+[13] P -> (12, 16)\n", "+[14] P -> ( 8, 14)\n", "+[15] P -> ( 2, 7)\n", "+[16] P -> (15, 4)\n", "+[17] P -> ( 0, 0)\n", "+[18] P -> (15, 13)\n", "+[19] P -> ( 2, 10)\n", "+[20] P -> ( 8, 3)\n" ] } ], "source": [ "for j in range(1, 20+1):\n", " bloq = ECAddR(n=5, R=j*P)\n", " ctrl, x, y = bloq.call_classically(ctrl=1, x=P.x, y=P.y)\n", " print(f'+[{j:2d}] P -> ({x:2d}, {y:2d})')" ] }, { "cell_type": "markdown", "id": "72c1ad66", "metadata": { "cq.autogen": "ECWindowAddR.bloq_doc.md" }, "source": [ "## `ECWindowAddR`\n", "Perform elliptic curve addition of many multiples of constant `R`.\n", "\n", "This adds R, 2R, ... 2^window_size into the register.\n", "\n", "#### Parameters\n", " - `n`: The bitsize of the two registers storing the elliptic curve point\n", " - `R`: The elliptic curve point to add (NOT in montgomery form).\n", " - `add_window_size`: The number of bits in the ECAdd window.\n", " - `mul_window_size`: The number of bits in the modular multiplication window. \n", "\n", "#### Registers\n", " - `ctrl`: `window_size` control bits.\n", " - `x`: The x component of the input elliptic curve point of bitsize `n` in montgomery form.\n", " - `y`: The y component of the input elliptic curve point of bitsize `n` in montgomery form. \n", "\n", "#### References\n", " - [How to compute a 256-bit elliptic curve private key with only 50 million Toffoli gates](https://arxiv.org/abs/2306.08585). Litinski. 2013. Section 1, eq. (3) and (4).\n" ] }, { "cell_type": "code", "execution_count": 19, "id": "289623e8", "metadata": { "cq.autogen": "ECWindowAddR.bloq_doc.py" }, "outputs": [], "source": [ "from qualtran.bloqs.cryptography.ecc import ECWindowAddR" ] }, { "cell_type": "markdown", "id": "dd6c7d57", "metadata": { "cq.autogen": "ECWindowAddR.example_instances.md" }, "source": [ "### Example Instances" ] }, { "cell_type": "code", "execution_count": 20, "id": "2ab0c101", "metadata": { "cq.autogen": "ECWindowAddR.ec_window_add_r_small" }, "outputs": [], "source": [ "n = 16\n", "P = ECPoint(2, 2, mod=7, curve_a=3)\n", "ec_window_add_r_small = ECWindowAddR(n=n, R=P, add_window_size=4)" ] }, { "cell_type": "markdown", "id": "dafa7d88", "metadata": { "cq.autogen": "ECWindowAddR.graphical_signature.md" }, "source": [ "#### Graphical Signature" ] }, { "cell_type": "code", "execution_count": 21, "id": "39be6000", "metadata": { "cq.autogen": "ECWindowAddR.graphical_signature.py" }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d40d8a9768e14fedaebe0e151f590ed0", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '\n", "\n", "counts\n", "\n", "\n", "\n", "b0\n", "\n", "ECWindowAddR\n", "\n", "\n", "\n", "b1\n", "\n", "QROAMClean\n", "\n", "\n", "\n", "b0->b1\n", "\n", "\n", "1\n", "\n", "\n", "\n", "b2\n", "\n", "ECAdd\n", "\n", "\n", "\n", "b0->b2\n", "\n", "\n", "1\n", "\n", "\n", "\n", "b3\n", "\n", "QROAMCleanAdjoint\n", "\n", "\n", "\n", "b0->b3\n", "\n", "\n", "1\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "#### Counts totals:\n", " - `ECAdd`: 1\n", " - `QROAMCleanAdjoint`: 1\n", " - `QROAMClean`: 1" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from qualtran.resource_counting.generalizers import ignore_split_join\n", "ec_window_add_r_small_g, ec_window_add_r_small_sigma = ec_window_add_r_small.call_graph(max_depth=1, generalizer=ignore_split_join)\n", "show_call_graph(ec_window_add_r_small_g)\n", "show_counts_sigma(ec_window_add_r_small_sigma)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.8" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "075c4e07a7714f0ead9acb487c447604": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "0c795e6d126f4b6780839020ebb81162": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "10f33e42e96946489f6ea56a4f02e0c0": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "1cc52dd232454217abafffb38eb6ed59": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_6f16ef5af58949bdb819dc0ec1644756" ], "layout": "IPY_MODEL_0c795e6d126f4b6780839020ebb81162", "tabbable": null, "tooltip": null } }, "28d4d999a72841e9ba4dedc023105d29": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "63755a4e82d84efa828b62ad90912d35": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/output", "_model_module_version": "1.0.0", "_model_name": "OutputModel", "_view_count": null, "_view_module": "@jupyter-widgets/output", "_view_module_version": "1.0.0", "_view_name": "OutputView", "layout": "IPY_MODEL_10f33e42e96946489f6ea56a4f02e0c0", "msg_id": "", "outputs": [ { "data": { "text/markdown": "`ec_pe_small`", "text/plain": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": "\n\nmy_graph\n\n\n\nx_G4\nx\n\n\n\nECPhaseEstimateR\n\nPE$(R_x, R_y)$\n\nx\n\ny\n\n\n\nx_G4:e->ECPhaseEstimateR:w\n\n\n3\n\n\n\ny_G2\ny\n\n\n\ny_G2:e->ECPhaseEstimateR:w\n\n\n3\n\n\n\nx_G1\nx\n\n\n\nECPhaseEstimateR:e->x_G1:w\n\n\n3\n\n\n\ny_G3\ny\n\n\n\nECPhaseEstimateR:e->y_G3:w\n\n\n3\n\n\n", "text/plain": "" }, "metadata": {}, "output_type": "display_data" } ], "tabbable": null, "tooltip": null } }, "656d782ee9854dc1b9efcbd28deb3a6d": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "6f16ef5af58949bdb819dc0ec1644756": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/output", "_model_module_version": "1.0.0", "_model_name": "OutputModel", "_view_count": null, "_view_module": "@jupyter-widgets/output", "_view_module_version": "1.0.0", "_view_name": "OutputView", "layout": "IPY_MODEL_c5557f179a9e468bad138cfb8626d5c6", "msg_id": "", "outputs": [ { "data": { "text/markdown": "`ecc`", "text/plain": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": "\n\nmy_graph\n\n\n\nFindECCPrivateKey\n\nFindECCPrivateKey\n\n\n", "text/plain": "" }, "metadata": {}, "output_type": "display_data" } ], "tabbable": null, "tooltip": null } }, "8df2c5520d5c4107938a7c8254770c55": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_e26234685f184706a4161fc6bdb09477", "IPY_MODEL_63755a4e82d84efa828b62ad90912d35" ], "layout": "IPY_MODEL_075c4e07a7714f0ead9acb487c447604", "tabbable": null, "tooltip": null } }, "9aa56e97bd7441babed3a5511141841c": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9cc3c057651541dd84a52fc34ec14cd9": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/output", "_model_module_version": "1.0.0", "_model_name": "OutputModel", "_view_count": null, "_view_module": "@jupyter-widgets/output", "_view_module_version": "1.0.0", "_view_name": "OutputView", "layout": "IPY_MODEL_9fd6baf9e3814bb8b33dc935d45b7986", "msg_id": "", "outputs": [ { "data": { "text/markdown": "`ec_window_add_r_small`", "text/plain": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": "\n\nmy_graph\n\n\n\nctrl_G13\nctrl[0]\n\n\n\nECWindowAddR\n\nECWindowAddR\n\nctrl[0]\n\nctrl[1]\n\nctrl[2]\n\nctrl[3]\n\nx\n\ny\n\n\n\nctrl_G13:e->ECWindowAddR:w\n\n\n1\n\n\n\nctrl_G10\nctrl[1]\n\n\n\nctrl_G10:e->ECWindowAddR:w\n\n\n1\n\n\n\nctrl_G16\nctrl[2]\n\n\n\nctrl_G16:e->ECWindowAddR:w\n\n\n1\n\n\n\nctrl_G2\nctrl[3]\n\n\n\nctrl_G2:e->ECWindowAddR:w\n\n\n1\n\n\n\nx_G4\nx\n\n\n\nx_G4:e->ECWindowAddR:w\n\n\n16\n\n\n\ny_G3\ny\n\n\n\ny_G3:e->ECWindowAddR:w\n\n\n16\n\n\n\nctrl_G14\nctrl[0]\n\n\n\nECWindowAddR:e->ctrl_G14:w\n\n\n1\n\n\n\nctrl_G12\nctrl[1]\n\n\n\nECWindowAddR:e->ctrl_G12:w\n\n\n1\n\n\n\nctrl_G17\nctrl[2]\n\n\n\nECWindowAddR:e->ctrl_G17:w\n\n\n1\n\n\n\nctrl_G5\nctrl[3]\n\n\n\nECWindowAddR:e->ctrl_G5:w\n\n\n1\n\n\n\nx_G15\nx\n\n\n\nECWindowAddR:e->x_G15:w\n\n\n16\n\n\n\ny_G8\ny\n\n\n\nECWindowAddR:e->y_G8:w\n\n\n16\n\n\n", "text/plain": "" }, "metadata": {}, "output_type": "display_data" } ], "tabbable": null, "tooltip": null } }, "9fd6baf9e3814bb8b33dc935d45b7986": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "ace23fdba2f84964971a8d5ad3f3b3d1": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/output", "_model_module_version": "1.0.0", "_model_name": "OutputModel", "_view_count": null, "_view_module": "@jupyter-widgets/output", "_view_module_version": "1.0.0", "_view_name": "OutputView", "layout": "IPY_MODEL_e760fe6de4a64a33897357aa75640c0a", "msg_id": "", "outputs": [ { "data": { "text/markdown": "`ec_add_r_small`", "text/plain": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": "\n\nmy_graph\n\n\n\nctrl_G0\nctrl\n\n\n\nECAddR\n\nECAddR\n\nctrl\n\nx\n\ny\n\n\n\nctrl_G0:e->ECAddR:w\n\n\n1\n\n\n\nx_G5\nx\n\n\n\nx_G5:e->ECAddR:w\n\n\n5\n\n\n\ny_G6\ny\n\n\n\ny_G6:e->ECAddR:w\n\n\n5\n\n\n\nctrl_G2\nctrl\n\n\n\nECAddR:e->ctrl_G2:w\n\n\n1\n\n\n\nx_G4\nx\n\n\n\nECAddR:e->x_G4:w\n\n\n5\n\n\n\ny_G3\ny\n\n\n\nECAddR:e->y_G3:w\n\n\n5\n\n\n", "text/plain": "" }, "metadata": {}, "output_type": "display_data" } ], "tabbable": null, "tooltip": null } }, "b05d9f14de2a43c48cf01e87c7f72abe": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_f791b5a6a1454c3dac60f14a879060dd", "IPY_MODEL_ace23fdba2f84964971a8d5ad3f3b3d1" ], "layout": "IPY_MODEL_656d782ee9854dc1b9efcbd28deb3a6d", "tabbable": null, "tooltip": null } }, "c0741653c4ce4aecb93498cf633f2662": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c5557f179a9e468bad138cfb8626d5c6": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "d40d8a9768e14fedaebe0e151f590ed0": { "model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_9cc3c057651541dd84a52fc34ec14cd9" ], "layout": "IPY_MODEL_28d4d999a72841e9ba4dedc023105d29", "tabbable": null, "tooltip": null } }, "e26234685f184706a4161fc6bdb09477": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/output", "_model_module_version": "1.0.0", "_model_name": "OutputModel", "_view_count": null, "_view_module": "@jupyter-widgets/output", "_view_module_version": "1.0.0", "_view_name": "OutputView", "layout": "IPY_MODEL_9aa56e97bd7441babed3a5511141841c", "msg_id": "", "outputs": [ { "data": { "text/markdown": "`ec_pe`", "text/plain": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": "\n\nmy_graph\n\n\n\nx_G0\nx\n\n\n\nECPhaseEstimateR\n\nPE$(R_x, R_y)$\n\nx\n\ny\n\n\n\nx_G0:e->ECPhaseEstimateR:w\n\n\nn\n\n\n\ny_G5\ny\n\n\n\ny_G5:e->ECPhaseEstimateR:w\n\n\nn\n\n\n\nx_G1\nx\n\n\n\nECPhaseEstimateR:e->x_G1:w\n\n\nn\n\n\n\ny_G2\ny\n\n\n\nECPhaseEstimateR:e->y_G2:w\n\n\nn\n\n\n", "text/plain": "" }, "metadata": {}, "output_type": "display_data" } ], "tabbable": null, "tooltip": null } }, "e760fe6de4a64a33897357aa75640c0a": { "model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f791b5a6a1454c3dac60f14a879060dd": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/output", "_model_module_version": "1.0.0", "_model_name": "OutputModel", "_view_count": null, "_view_module": "@jupyter-widgets/output", "_view_module_version": "1.0.0", "_view_name": "OutputView", "layout": "IPY_MODEL_c0741653c4ce4aecb93498cf633f2662", "msg_id": "", "outputs": [ { "data": { "text/markdown": "`ec_add_r`", "text/plain": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": "\n\nmy_graph\n\n\n\nctrl_G0\nctrl\n\n\n\nECAddR\n\nECAddR\n\nctrl\n\nx\n\ny\n\n\n\nctrl_G0:e->ECAddR:w\n\n\n1\n\n\n\nx_G7\nx\n\n\n\nx_G7:e->ECAddR:w\n\n\nn\n\n\n\ny_G6\ny\n\n\n\ny_G6:e->ECAddR:w\n\n\nn\n\n\n\nctrl_G2\nctrl\n\n\n\nECAddR:e->ctrl_G2:w\n\n\n1\n\n\n\nx_G4\nx\n\n\n\nECAddR:e->x_G4:w\n\n\nn\n\n\n\ny_G8\ny\n\n\n\nECAddR:e->y_G8:w\n\n\nn\n\n\n", "text/plain": "" }, "metadata": {}, "output_type": "display_data" } ], "tabbable": null, "tooltip": null } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }