diff --git a/00_qkd.md b/00_qkd.md new file mode 100644 index 0000000..60d23f1 --- /dev/null +++ b/00_qkd.md @@ -0,0 +1,18 @@ +# Implement Quantum Key Distribution (QKD) in Python + +1. You have Alice and Bob who want to communicate, they have a quantum and a +classical channel. +2. There is of course Mallory who can be the standard Man-in-the-middle, +listening on both channels (with QKD we should be able to at least detect her) +3. Alice and Bob should be able to agree on a One-Time-Pad (OTP) - a series +of bytes that are random. Using this, they can use whatever protocol to +actually encrypt messages (imagine even ceaser shift where each letter is +shifted by that many units using the OTP bits, or even simpler - XORing) +4. Alice and Bob are able to agree on an OTP using qbits in two orthogonal +quantum bases where Bob chooses at random which base to measure and what output +he got. + + +## Sources: +* [The Code Book](https://www.amazon.com/Code-Book-Science-Secrecy-Cryptography/dp/0385495323) +* [wiki](https://en.wikipedia.org/wiki/Quantum_key_distribution) diff --git a/01_computer.md b/01_computer.md new file mode 100644 index 0000000..8234d53 --- /dev/null +++ b/01_computer.md @@ -0,0 +1,8 @@ +# Quantum Computer in Python from first principles + +1. Reinvent how to multiply matrices +2. Present qbits and gates as matrices +3. Override multiplication for qbits to be tensor multiplication and for gates +to be matrix (TODO: why??) +4. Test basic operations such as Identity matrix, Pauli gates, creating +superposition with Hadamard, creating entanglement with CNOT. diff --git a/02_INSTALL_CIRQ.sh b/02_INSTALL_CIRQ.sh new file mode 100755 index 0000000..b8bb8ca --- /dev/null +++ b/02_INSTALL_CIRQ.sh @@ -0,0 +1,5 @@ +#!/bin/bash +sudo apt-get install python3-tk texlive-latex-base latexmk +virtualenv -p python3 venv +source venv/bin/activate +pip install -r requirements.txt diff --git a/02_cirq.md b/02_cirq.md new file mode 100644 index 0000000..f4bea3c --- /dev/null +++ b/02_cirq.md @@ -0,0 +1,7 @@ +# Learning Google's CIRQ + +You need to run `./02_INSTALL_CIRQ.sh` to install this (at least on Ubuntu-based +distros, having naturally python > 3.5, check with `python3 --version`) + +## Sources: +* [Official Tutorial](https://cirq.readthedocs.io/en/stable/tutorial.html) diff --git a/02_cirq.py b/02_cirq.py index f40d918..1144b42 100644 --- a/02_cirq.py +++ b/02_cirq.py @@ -15,4 +15,24 @@ print(circuit) simulator = cirq.Simulator() result = simulator.run(circuit, repetitions=20) print("Results:") -print(result) \ No newline at end of file +print(result) + + +# ----- Tutorial +import cirq +import numpy as np +import matplotlib + +# Print Google's 72-qbit Bristlecone +print(cirq.google.Bristlecone) + +# Use named Qubits +a = cirq.NamedQubit("a") +b = cirq.NamedQubit("b") +c = cirq.NamedQubit("c") +ops = [cirq.H(a), cirq.H(b), cirq.CNOT(b, c), cirq.H(b)] +circuit = cirq.Circuit.from_ops(ops) +print(circuit) + +for i, moment in enumerate(circuit): + print('Moment {}: {}'.format(i, moment)) diff --git a/03_shors.md b/03_shors.md index 6de8fb4..36520fe 100644 --- a/03_shors.md +++ b/03_shors.md @@ -1,3 +1,5 @@ +# High level overview of RSA and Shor's algo + RSA relies on: ``` @@ -26,4 +28,5 @@ A, B -> A^p = m*B + 1 ``` - +## Sources: +* [Minute Physics - Quantum Crypto video](https://www.youtube.com/watch?v=lvTqbM5Dq4Q) diff --git a/README.md b/README.md new file mode 100644 index 0000000..945b3e3 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Quantum + +This is an experimental repo where I learn quantum computers. +See corresponding md-s for explanation of each. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b535938 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,43 @@ +backcall==0.1.0 +cachetools==3.1.1 +certifi==2019.9.11 +chardet==3.0.4 +cirq==0.5.0 +cycler==0.10.0 +decorator==4.4.0 +google-api-python-client==1.7.11 +google-auth==1.6.3 +google-auth-httplib2==0.0.3 +httplib2==0.13.1 +idna==2.8 +ipython==7.8.0 +ipython-genutils==0.2.0 +jedi==0.15.1 +kiwisolver==1.1.0 +matplotlib==2.2.4 +mpmath==1.1.0 +networkx==2.3 +numpy==1.17.2 +parso==0.5.1 +pexpect==4.7.0 +pickleshare==0.7.5 +prompt-toolkit==2.0.9 +protobuf==3.9.2 +ptyprocess==0.6.0 +pyasn1==0.4.7 +pyasn1-modules==0.2.6 +Pygments==2.4.2 +pyparsing==2.4.2 +python-dateutil==2.8.0 +pytz==2019.2 +requests==2.22.0 +rsa==4.0 +scipy==1.3.1 +six==1.12.0 +sortedcontainers==2.1.0 +sympy==1.4 +traitlets==4.3.2 +typing-extensions==3.7.4 +uritemplate==3.0.0 +urllib3==1.25.6 +wcwidth==0.1.7