DUE Friday, November 6th, 2026

Poster reminders: the first draft (complete, in LaTeX) is due Friday, November 6th, and the final version and report of work are due Friday, November 13th. Details on the Posters tab.

Test make-ups: you can still improve your Test 1 and Test 2 scores by retaking one Part B problem from each test (a written replacement problem on Canvas if you scored 7 or higher on it, or a 15-minute in-person retake booked through the calendar link on the Canvas main page if you scored 6 or lower). Details in the October 16th post.

Today we met the quantum Fourier transform (QFT). Since your poster drafts are due Friday, I’ll keep this daily post short, but it would be good to do a bit of basic computation with the QFT.

Relevant Textbook Sections:

Chapter 6 (Quantum): roots of unity and the quantum Fourier transform.

To Do:

  1. Apply the 4×44 \times 4 QFT matrix to the state

    12(∣00⟩+1+i2∣01⟩+1−i2∣11⟩).\frac{1}{\sqrt{2}} \left( |00\rangle + \frac{1+i}{2} |01\rangle + \frac{1-i}{2} |11\rangle \right).
  2. Draw the 88th roots of unity in the complex plane and label them. You can use the 88th root of unity notation ω:=ω8=eiπ/4\omega := \omega_8 = e^{i\pi/4}, but simplify so that the labels are from the set {1,−1,i,−i,ω,−ω,iω,−iω}\{1, -1, i, -i, \omega, -\omega, i\omega, -i\omega\}.

  3. Write down the QFT matrix of dimension 8×88 \times 8. Again, use the notation ω:=ω8=eiπ/4\omega := \omega_8 = e^{i\pi/4}, but simplify so that the entries are all from the set {1,−1,i,−i,ω,−ω,iω,−iω}\{1, -1, i, -i, \omega, -\omega, i\omega, -i\omega\}. (Hang on to this; we’ll use it to run Shor’s algorithm by hand next time.)

Optional: the Visualizing Complex Numbers & QFT and QFT Amplitudes pages (under the Tools menu, Module 4) let you watch the roots of unity sum up in the QFT of a periodic state.

DUE Wednesday, November 4th, 2026

Poster reminders: the first draft (complete, in LaTeX) is due Friday, November 6th, and the final version and report of work are due Friday, November 13th. Details on the Posters tab.

Solutions: solutions to the daily posts due October 23rd (qubits and the LL/VV bases), October 26th (BB84 on paper, key length, catching Eve), October 30th (two-qubit states and entanglement), and November 2nd (multi-qubit measurement and single-qubit gates) are posted. All daily post solutions are collected on the Archive page.

Today we built gates on two and more qubits (CNOT, Hadamard on one qubit of a system, the reversible AND), and saw the general principle that any classical function can be computed quantumly, as long as we make it reversible. Here are some problems in those directions.

Relevant Textbook Sections:

Chapter 6 (Quantum): multi-qubit gates, CNOT, the reversible AND (Toffoli) gate, and computing classical functions reversibly.

To Do:

Unitary matrices.

  1. Verify that the product of two unitary matrices is unitary. (This may require reviewing the transpose of a product.)
  2. Verify that a unitary matrix is invertible and its inverse is unitary.

Two-qubit gates.

  1. Verify that the CNOT gate (1000010000010010)\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix} is unitary.
  2. Apply the CNOT gate to the state 1+2i6∣01⟩+16∣10⟩\frac{1+2i}{\sqrt{6}}|01\rangle + \frac{1}{\sqrt{6}}|10\rangle.
  3. Consider “applying the Hadamard gate to the second qubit” as a two-qubit gate.
    1. What does this do to the state ∣00⟩|00\rangle?
    2. What does this do to the state ∣01⟩|01\rangle?
    3. Write out the two-qubit 4×44 \times 4 matrix that does this, and verify that it is unitary.
  4. Begin with the 2-qubit state ∣00⟩|00\rangle.
    1. Apply the CNOT gate to the 2-qubit system and then the Hadamard gate to the 2nd qubit.
    2. Start over with ∣00⟩|00\rangle. Now apply the Hadamard gate to the 2nd qubit and then the CNOT gate to the system. Do you get the same answer?
    3. Repeat the last two parts with the Hadamard gate applied to the 1st qubit instead of the 2nd. Do you get the same answer this time? Is either output entangled?
  5. Determine a 22-qubit quantum circuit that will, on input ∣00⟩|00\rangle, produce output 12∣00⟩+12∣01⟩+12∣10⟩+12∣11⟩\frac{1}{2}|00\rangle + \frac{1}{2}|01\rangle + \frac{1}{2}|10\rangle + \frac{1}{2}|11\rangle. Hint: combine Hadamard gates.

Classical functions, quantumly.

  1. Apply the reversible AND gate (as demonstrated in class) to the state 12∣000⟩+12∣011⟩+12∣101⟩+12∣111⟩\frac{1}{2}|000\rangle + \frac{1}{2}|011\rangle + \frac{1}{2}|101\rangle + \frac{1}{2}|111\rangle.
  2. Make an 8×88 \times 8 unitary matrix that implements a reversible OR gate.
  3. Let f(x1,x2)=x1⊕x2f(x_1, x_2) = x_1 \oplus x_2 (XOR), and let UfU_f be the three-qubit gate Uf∣x1x2⟩∣y⟩=∣x1x2⟩∣y⊕f(x1,x2)⟩U_f |x_1 x_2\rangle |y\rangle = |x_1 x_2\rangle |y \oplus f(x_1,x_2)\rangle.
    1. Describe what UfU_f does to each of the eight basis states. Explain why this guarantees UfU_f is unitary.
    2. Apply UfU_f to 12(∣00⟩+∣01⟩+∣10⟩+∣11⟩)∣0⟩\frac{1}{2}\left( |00\rangle + |01\rangle + |10\rangle + |11\rangle \right)|0\rangle. Notice that you have evaluated ff on all four inputs at once.
    3. Express UfU_f as a composition of two CNOT gates.

DUE Monday, November 2nd, 2026

Happy Almost Hallowe’en! Today we did two-qubit (and more-qubit) systems and met our first quantum gate, so here are a few problems in those directions.

Posters: don’t forget to work on your posters; check the Posters tab for the next deadline.

Relevant Textbook Sections:

Chapter 6 (Quantum): multiple qubits, entanglement, measuring one qubit of a multi-qubit state, and single-qubit gates.

To Do:

  1. Consider the state 12∣01⟩+12∣10⟩\frac{1}{\sqrt{2}}|01\rangle + \frac{1}{\sqrt{2}}|10\rangle.
    1. What is the probability of measuring a 00 in the first bit?
    2. What is the probability of measuring a 00 in the second bit?
    3. What is the probability of measuring a 00 in both bits? (I.e. after measuring both bits, what’s the probability you obtained 0000?)
  2. For each of the following, determine if it is entangled or not (i.e. whether it can be written as a product of single-qubit states):
    1. ∣111⟩|111\rangle
    2. 12∣10⟩+12∣11⟩\frac{1}{\sqrt{2}}|10\rangle + \frac{1}{\sqrt{2}}|11\rangle
    3. 12∣110⟩+12∣111⟩\frac{1}{\sqrt{2}}|110\rangle + \frac{1}{\sqrt{2}}|111\rangle
    4. 12∣010⟩+12∣111⟩\frac{1}{\sqrt{2}}|010\rangle + \frac{1}{\sqrt{2}}|111\rangle
  3. In the state 12∣010⟩+12∣111⟩\frac{1}{\sqrt{2}}|010\rangle + \frac{1}{\sqrt{2}}|111\rangle, what is the probability of measuring a 00 in the first qubit? middle qubit? last qubit?
  4. Measure the following states in the first qubit and report the possible outcome bits, outcome states (the state of the system after the measurement), and probabilities. Don’t forget to normalize.
    1. the Bell state 12∣00⟩+12∣11⟩\frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle
    2. 114∣01⟩+2i14∣10⟩+314∣11⟩\frac{1}{\sqrt{14}}|01\rangle + \frac{2i}{\sqrt{14}}|10\rangle + \frac{3}{\sqrt{14}}|11\rangle

Quantum gates. A bit of practice with the linear algebra behind gates:

  1. Compute the complex conjugates of 3+7i3+7i, 88 and 8i8i.
  2. Compute the conjugate transpose of the complex matrix (12+i3ii)\begin{pmatrix} 1 & 2+i \\ 3i & i \end{pmatrix}. Check if this matrix is unitary.
  3. Apply the Pauli ZZ gate (100−1)\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} to the single-qubit state 1+2i6∣0⟩+16∣1⟩\frac{1+2i}{\sqrt{6}}|0\rangle + \frac{1}{\sqrt{6}}|1\rangle. What is the output? Does measuring the output in the ∣0⟩|0\rangle, ∣1⟩|1\rangle basis give different probabilities than measuring the input?
  4. Consider the single-qubit states ∣ψ⟩=12∣0⟩+12∣1⟩|\psi\rangle = \frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle and ∣ϕ⟩=12∣0⟩−12∣1⟩|\phi\rangle = \frac{1}{\sqrt{2}}|0\rangle - \frac{1}{\sqrt{2}}|1\rangle.
    1. Explain why, measuring the states in the basis ∣0⟩|0\rangle, ∣1⟩|1\rangle, you can’t tell the difference between these states.
    2. Now apply the Hadamard gate H=12(111−1)H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} to both states. Explain what happens to H∣ψ⟩H|\psi\rangle and H∣ϕ⟩H|\phi\rangle if you measure in the basis ∣0⟩|0\rangle, ∣1⟩|1\rangle. Can you tell the difference between these by measuring?
  5. Create a unitary single-qubit gate that takes ∣0⟩|0\rangle to a normalized version of ∣0⟩+i∣1⟩|0\rangle + i|1\rangle.

DUE Friday, October 30th, 2026

Today was Test 3. Take a breath! On Friday we continue Module 4 (Quantum) by moving from one qubit to two qubits, which is where quantum computing begins. The problems below are a warm-up for that: nothing here needs anything beyond the single-qubit rules from lecture (a state a∣0⟩+b∣1⟩a|0\rangle + b|1\rangle with ∣a∣2+∣b∣2=1|a|^2 + |b|^2 = 1 gives outcome 00 with probability ∣a∣2|a|^2 and outcome 11 with probability ∣b∣2|b|^2), but by the end you will have met the main new phenomenon with your own hands.

Relevant Textbook Sections:

Chapter 6 (Quantum): review single qubit states and measurement. On Friday we move on to multiple qubits.

To Do:

  1. Two qubits, measured separately. Alice prepares two qubits, one after the other, and Bob measures each one in the ∣0⟩|0\rangle, ∣1⟩|1\rangle basis.

    1. The first qubit is ∣0⟩|0\rangle and the second is 12∣0⟩+12∣1⟩\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle. List the four possible pairs of outcomes (first qubit, second qubit) and the probability of each.
    2. Now both qubits are 12∣0⟩+12∣1⟩\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle. List the four possible pairs of outcomes and their probabilities.
    3. Now the first qubit is 15∣0⟩+25∣1⟩\frac{1}{\sqrt{5}}|0\rangle + \frac{2}{\sqrt{5}}|1\rangle and the second is 12∣0⟩−12∣1⟩\frac{1}{\sqrt{2}}|0\rangle - \frac{1}{\sqrt{2}}|1\rangle. Same question.
  2. Two qubits as one state. We can write a pair of qubits as a single “two-qubit state” by writing the two states side by side. For the pair in problem 1(1), that is ∣0⟩(12∣0⟩+12∣1⟩)|0\rangle\left(\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle\right). Multiply out as if these were ordinary products, keeping the first qubit first, and write ∣0⟩∣0⟩|0\rangle|0\rangle as ∣00⟩|00\rangle, ∣0⟩∣1⟩|0\rangle|1\rangle as ∣01⟩|01\rangle, and so on:

    ∣0⟩(12∣0⟩+12∣1⟩)=12∣00⟩+12∣01⟩.|0\rangle\left(\tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}|1\rangle\right) = \tfrac{1}{\sqrt{2}}|00\rangle + \tfrac{1}{\sqrt{2}}|01\rangle.

    The four states ∣00⟩|00\rangle, ∣01⟩|01\rangle, ∣10⟩|10\rangle, ∣11⟩|11\rangle are the possible outcomes when both qubits are measured, and the squared lengths of the coefficients are the probabilities, just as for one qubit.

    1. Check that this agrees with your answer to 1(1).
    2. Multiply out (12∣0⟩+12∣1⟩)(12∣0⟩+12∣1⟩)\left(\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle\right)\left(\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle\right) and check that it agrees with your answer to 1(2).
    3. Multiply out (15∣0⟩+25∣1⟩)(12∣0⟩−12∣1⟩)\left(\frac{1}{\sqrt{5}}|0\rangle + \frac{2}{\sqrt{5}}|1\rangle\right)\left(\frac{1}{\sqrt{2}}|0\rangle - \frac{1}{\sqrt{2}}|1\rangle\right) and check that it agrees with your answer to 1(3). Note the minus signs: they don’t affect the probabilities here, but hang on to them.
    4. Check that in each case the squared lengths of the four coefficients add up to 11.
  3. An unusual two-qubit state. Now take the rule from problem 2 as the definition: a two-qubit state is any

    a∣00⟩+b∣01⟩+c∣10⟩+d∣11⟩,∣a∣2+∣b∣2+∣c∣2+∣d∣2=1,a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle, \qquad |a|^2 + |b|^2 + |c|^2 + |d|^2 = 1,

    and measuring both qubits gives outcome 0000 with probability ∣a∣2|a|^2, outcome 0101 with probability ∣b∣2|b|^2, and so on. Consider the state

    ∣Φ⟩=12∣00⟩+12∣11⟩.|\Phi\rangle = \tfrac{1}{\sqrt{2}}|00\rangle + \tfrac{1}{\sqrt{2}}|11\rangle.
    1. What are the probabilities of the four outcomes 0000, 0101, 1010, 1111 when Bob measures both qubits?
    2. What is the probability that the first qubit comes out 00? (Add up the probabilities of all outcomes whose first bit is 00.)
    3. Suppose Bob measures only the first qubit and gets 00. What can he now say about the second qubit, before measuring it? Compare with the state from problem 2(2), where knowing the first outcome tells you nothing about the second.
    4. Try to write ∣Φ⟩|\Phi\rangle as a product of two single-qubit states, (x∣0⟩+y∣1⟩)(z∣0⟩+w∣1⟩)(x|0\rangle + y|1\rangle)(z|0\rangle + w|1\rangle), by multiplying out and comparing coefficients. Show that it is impossible. (You will need xw=0xw = 0 and yz=0yz = 0, but also xz≠0xz \neq 0 and yw≠0yw \neq 0.)

    A state that cannot be written as a product of single-qubit states is called entangled. Its two qubits are not independent, even if they are far apart.

  4. Normalize first. Normalize the state ∣00⟩+2i∣01⟩−2∣11⟩|00\rangle + 2i|01\rangle - 2|11\rangle, then give the probabilities of the four outcomes when both qubits are measured. Is it a product state or entangled?

DUE Monday, October 26th, 2026

Reminder: Test 3 (Module 3) is in class on Wednesday, October 28th. The syllabus on the Tests tab is now updated (elliptic curves, plus the quantum material through today: qubits, superposition, measurement, and quantum key distribution), along with review problems.

Today we finished Quantum Key Distribution (BB84)!

Lecture notes and video: my notes from today’s Zoom lecture are posted (also on the Notes/Videos page and the Archive). The link to the Zoom recording is on discord.

Relevant Textbook Sections:

Chapter 6 (Quantum): quantum key distribution.

To Do:

We use the encoding from lecture: in the LL basis, ∣↑⟩|\uparrow\rangle is the bit 00 and ∣→⟩|\rightarrow\rangle is the bit 11; in the VV basis, ∣↖⟩|\nwarrow\rangle is the bit 00 and ∣↗⟩|\nearrow\rangle is the bit 11.

  1. Play Alice and Bob on paper. Alice sends eight photons and Bob measures them:

    Photon12345678
    Alice’s basisLLVVVVLLVVLLLLVV
    Alice’s bit10110010
    Bob’s basisLLLLVVVVVVLLVVVV
    Bob’s measured bit11100010
    1. Which photon (which arrow) did Alice send each time?
    2. After Alice and Bob announce their bases publicly, which photons do they keep? What is their shared secret key?
    3. For photon 2, Bob measured a 11 but Alice sent a 00. Explain why this is not an error, and why photon 2 tells Bob nothing about Alice’s bit.
    4. Eve was listening to the public conversation. What does she learn?
  2. Quantum Key Distribution in pairs! I think this will get confusing with everyone simultaneously on the #ciphertexts channel, so I want you to do this in pairs in the “QKD pairs” channel category of discord. There you will find plenty of text channels, so fill them up with two people each as you arrive, taking the first empty spot (the first person needing a partner or the first unused channel). Announce your arrival. The first person to arrive in a channel is Alice, the second person to arrive is Bob. Once two people are there, it’s full, so pick the next channel. You’ll do all communication on the channel so I can help you debug if it doesn’t work.

    • Open up the QKD BB84 Tools. The first box contains some code to initialize; no need to read this, just run it. The second box is a spot where you can either create photons (in our instantiation, they are just mysterious looking integers), or measure existing photons. It just holds an example for now.
    • Once you know if you are Alice or Bob, follow the protocol for your role.
    • If playing the role of ALICE:
      1. Here’s a spreadsheet you might find useful (optional; view only but you can copy it).
      2. Choose a sequence of 16 random choices of basis: example V L V V etc. The best way to do this is with a random number generator (like randint() in Sage).
      3. Now choose a sequence of 16 bits: example 011001010101 etc. Again, true or good pseudo-randomness is best.
      4. Use your two sequences to generate photons using the command generate_photon in the QKD BB84 Tools page. This will create 16 integers (the photons), which you should obtain and paste into the channel as your “outgoing photon stream”.
      5. Wait until Bob harvests your photon stream and reports that they are done “measuring” the photons.
      6. Then, post to the channel the list of bases you used on your photons.
      7. Bob will also post their list of bases used on the channel.
      8. Then, determine the shared secret key from these two lists. Share it and see if Bob agrees.
    • If playing the role of BOB:
      1. Here’s a spreadsheet you might find useful (optional; view only but you can copy it).
      2. Choose a sequence of 16 random choices of basis: example V L V V etc. The best way to do this is with a random number generator (like randint() in Sage). Keep this secret for now.
      3. Alice will create a stream of photons (integers). Harvest (cut-n-paste) Alice’s photon stream, and use the command measure_photon() in the QKD BB84 Tools page to measure them using your list of bases (first basis to measure first photon etc.) Record the measurements and keep them secret.
      4. Report to the channel you have finished measuring.
      5. Then, report to the channel your list of bases.
      6. When Alice also reports her list of bases, derive the shared secret.
      7. Then, post the shared secret you derived to check if it agrees with Alice’s.
    • To Do: When you’re done, just post to canvas a screenshot or record of your experience; you can screenshot the channel or you can screenshot your spreadsheet or a text file you kept a record in; whatever, just to show you did it.
  3. How long is the key?

    1. For each photon, what is the probability that Alice and Bob chose the same basis?
    2. In the pairs exercise above, you sent 16 photons. What is the expected length of the shared key? What is the probability that the key has exactly that length? How long was the key you actually got?
    3. If Alice and Bob need a 128-bit key, about how many photons should Alice send?
  4. Eve intercepts. Alice sends ∣↗⟩|\nearrow\rangle. Eve intercepts it, measures it in the LL basis, and sends Bob a fresh photon in whatever state she measured. Bob measures in the VV basis.

    1. What are the possible outcomes of Eve’s measurement, and their probabilities? What photon does she send on to Bob in each case?
    2. What is the probability that Bob measures the bit 11, as Alice intended?
    3. What would have happened if Eve had guessed the VV basis instead?
  5. Catching Eve. Now suppose Eve intercepts every photon, measures each in a randomly chosen basis, and resends what she measured.

    1. Consider a photon where Alice and Bob chose the same basis (so it goes into the key). Show that the probability Bob’s bit disagrees with Alice’s is 14\frac{1}{4}.
    2. To check for Eve, Alice and Bob publicly compare 20 of their key bits (and then throw those bits away). If Eve intercepted every photon, what is the probability that all 20 bits agree anyway, so Eve goes undetected?
    3. Why is it safe for Alice and Bob to announce their bases publicly, but not their bits?

DUE Friday, October 23rd, 2026

Reminder: Class on Friday, October 23rd will again be on Zoom, due to my illness. The link is in Canvas. If you need a quiet place to join, you are welcome to use our usual classroom. The class will be recorded, but please attend synchronously if you can.

Welcome to Module 4: Quantum! Today we met complex numbers, qubits, measurement, the LL and VV bases, and the three filter experiment.

Lecture notes and video: my notes from today’s Zoom lecture are posted (also on the Notes/Videos page and the Archive). The link to the Zoom recording is on discord.

Relevant Textbook Sections:

The opening of Chapter 6 (Quantum): complex numbers, single qubit states, and measurement.

To Do:

  1. Complex numbers worksheet. Work through whatever parts are most useful or interesting to you of the online Complex Numbers Worksheet. My suggestion: if you’re comfortable with complex numbers as done in class, then start at “Domain Colouring,” which is just lovely. If complex numbers are new to you, the earlier parts of the worksheet will give you the practice you need for the rest of the module.
  2. Compute the length of the complex number 35+45i\frac{3}{5} + \frac{4}{5}i. (The answer should be 11; please make sure you got this!)
  3. Consider the qubit superposition i∣0⟩+3∣1⟩i|0\rangle + \sqrt{3}|1\rangle.
    1. Normalize it so that ∣a∣2+∣b∣2=1|a|^2 + |b|^2 = 1.
    2. Measure it in the basis ∣0⟩|0\rangle, ∣1⟩|1\rangle. What are the possible outcomes and their probabilities?
  4. Recall the LL basis ∣↑⟩|\uparrow\rangle, ∣→⟩|\rightarrow\rangle and the VV basis ∣↗⟩|\nearrow\rangle, ∣↖⟩|\nwarrow\rangle, where ∣↗⟩=12(∣↑⟩+∣→⟩)|\nearrow\rangle = \frac{1}{\sqrt{2}}\left(|\uparrow\rangle + |\rightarrow\rangle\right) and ∣↖⟩=12(∣↑⟩−∣→⟩)|\nwarrow\rangle = \frac{1}{\sqrt{2}}\left(|\uparrow\rangle - |\rightarrow\rangle\right).
    1. Measure ∣↗⟩|\nearrow\rangle in the LL basis (i.e. give the outcomes and their probabilities).
    2. Measure ∣↗⟩+i∣↖⟩|\nearrow\rangle + i|\nwarrow\rangle in the LL basis. (Normalize first!)
  5. Consider the state ∣ψ⟩=15∣↑⟩+25∣→⟩|\psi\rangle = \frac{1}{\sqrt{5}}|\uparrow\rangle + \frac{2}{\sqrt{5}}|\rightarrow\rangle.
    1. Measure it in the LL basis. What are the possible outcomes and their probabilities?
    2. Measure it in the VV basis. What are the possible outcomes and their probabilities? (To do this, you will first need to write ∣ψ⟩|\psi\rangle as a normalized linear combination of ∣↗⟩|\nearrow\rangle and ∣↖⟩|\nwarrow\rangle.)

DUE Wednesday, October 21st, 2026

Reminder: Class on Wednesday, October 21st is on Zoom. The link is in Canvas. If you need a quiet place to join, you are welcome to use our usual classroom. The class will be recorded, but please attend synchronously if you can.

Solutions: solutions to the daily posts due October 16th (elliptic curve multiples table) and October 19th (EC El Gamal chain and Pollard p−1p-1) are posted. All daily post solutions are collected on the Archive page.

Relevant Textbook Sections:

5.4 (Factoring with elliptic curves), including 5.4.1 (An example motivating the key idea), 5.4.2 (Pollard’s p−1p-1 factoring algorithm) and 5.4.3 (Elliptic Curve Factoring). Review 3.8.1 (Pollard’s rho factoring method).

To Do:

  1. Finish up the Elliptic Curve El Gamal ciphertext chain from last time: make sure you have decrypted any message encrypted to your public key (and announced the plaintext, @mentioning the sender), that your own message has been decrypted and confirmed, and that your notes are handed in to the canvas dropbox.
  2. On the curve y2=x3+x+1y^2 = x^3 + x + 1 modulo 9191, check that P=(0,1)P = (0,1) and Q=(7,13)Q = (7,13) are on the curve, and then try to compute P+QP + Q by hand. What goes wrong when you compute the slope? Use the failure to factor 9191. Then reduce PP and QQ modulo each prime factor of 9191: what is P+QP + Q modulo each prime? Explain why the computation broke down.
  3. Use the EC Factoring Example page to factor n=290265623n = 290265623. You might want to increase the size of the loop! Write up a short explanation of your work.
  4. A factoring race. We now have three factoring methods that each look for a prime factor pp of nn “by accident.” Run all three on the same n=290265623n = 290265623 from problem 3 and record how long each one takes:
    1. Pollard’s ρ\rho with f(x)=x2+1f(x) = x^2 + 1 and x0=2x_0 = 2: how many steps until gcd⁡(x2i−xi,n)\gcd(x_{2i} - x_i, n) is nontrivial? (nn is too big for the Pollard Rho Demo, so use the Sage Pollard Rho page, which keeps a tortoise and a rabbit and prints the gcd at each step.)
    2. Pollard’s p−1p-1 with a=2a = 2 (use the Pollard p-1 page from last time): what is the first BB for which gcd⁡(aB!−1,n)\gcd(a^{B!}-1, n) is nontrivial? Again, you may need to increase the size of the loop.
    3. Elliptic curve factoring (problem 3; you already did this): which multiple blew up?
  5. Now factor p−1p - 1 for each prime factor pp of nn from the last problem. Use this to explain the p−1p-1 result exactly.
  6. Recall that Pollard’s ρ\rho takes about p\sqrt{p} steps. Compare p\sqrt{p} with your step count from problem 4.
  7. In Sage, EllipticCurve(GF(p), [1,1])(0,1).order() computes the order of the point (0,1)(0,1) on y2=x3+x+1y^2 = x^3 + x + 1 modulo a prime pp (change the coefficients and the point if you used a different curve in problem 3). Compute this order modulo each prime factor of nn, and factor the answers. Use this to explain which multiple blew up in problem 3.
  8. For which kinds of nn would you choose ρ\rho, which p−1p-1, and which elliptic curves?
  9. If time remains, explore EC Factoring further:
    1. Factor n=290265623n = 290265623 again with a different choice of curve and point (revisit lecture for some advice on finding random curve + point pairs).
    2. Try modifying one of the middle digits of nn, and see how long it takes. Factor nn completely using Sage’s factor() function, to see what kinds of primes it has in it. Repeat a few more times.
    3. Report/discuss on discord on how long it took (i.e., what multiple of PP blew up) on different curves and points, and different nn. Explain why you think it was fast sometimes and slow other times. You can use the #daily-collaboration channel.

DUE Monday, October 19th, 2026

Test make-ups: You have an opportunity to improve your grade on Test 1 and Test 2. Here’s how it works. For each test, you may retake one of the 10 point problems in Part B that you attempted. That means solving a similar problem. Your retake score replaces your original score on that problem, so you can completely make up the lost points (up to the full 10 points).

  • If you got 7 or higher on your problem, you will do a written replacement problem. The written retakes are posted on canvas.
  • If you got 6 or lower, you will schedule to meet in person for a retake. Use the calendar link on the canvas main page for appointments (15 minute slot).

Deadlines: Test 1 make-ups must be done by the end of October (Friday, October 30th). Test 2 make-up deadline: TBA.

Relevant Textbook Sections:

5.6 (Elliptic Curve Diffie-Hellman), 5.7 (Elliptic Curve El Gamal), including 5.7.1 (Placing a message on a curve) and 5.7.2 (Square roots modulo pp).

To Do:

  1. An Elliptic Curve El Gamal Ciphertext Chain! Today’s question: best hallowe’en costume? You will encrypt your answer. Here are the steps:
    1. Keep notes as you do all this. Here are the EC El Gamal Tools you can use to do this.
    2. As a group, we will all use the elliptic curve EE given by y2=x3+x2+x+1y^2 = x^3 + x^2 + x + 1 over the finite field of p=123456789101234567891027p = 123456789101234567891027 elements. We will furthermore use the point P = E([3,11655832467975276266127,1]) on EE, which has order 6172839455094928761473161728394550949287614731.
    3. You should create a private and public key pair based on the information given above. Publish your public key on the #public-keys channel on discord (note: this is a point (x,y)(x,y) on the curve). Keep your private key in a text document somewhere to use for decrypting later.
    4. You should answer the question (Best hallowe’en costume?) with a word of 6 or fewer letters. Translate this to an integer (Text to Integer tool as usual) and add three digits of “padding” “000” at the end.
    5. Turn your message into a point on the elliptic curve as described in class. This might mean updating the padding to “001”, “002” etc. until it works. For this step, you need to take modular square roots. The command is sqrt. For example, sqrt(Mod(2,7)) will give you the square root of 22 modulo 77 (which is 33). If it returns something with the string ‘sqrt’ in it, that means it failed (no square root), e.g. sqrt(Mod(3,7)) will just return sqrt3 — that means no square root.
    6. You should then obtain the most recent public key on the #public-keys channel, and encrypt your message (turned into a point on the curve) to that public key. Post your encryption to the #ciphertexts channel, @mentioning the owner of the public key it is encrypted to.
    7. You should then keep an eye on the channel and when someone encrypts a message to your public key (they should @mention you), you should decrypt it and announce what the plaintext was, @mentioning them back.
    8. When someone decrypts your message, you should give them a thumbs up to let them know it’s right (or let them know if it isn’t).
    9. Hand in your notes from this exercise to the canvas dropbox.
    10. Challenge for fun: break someone else’s message! Hint: factor the order of PP.
  2. Today we introduced Pollard’s p−1p-1 algorithm. As a recap, to factor nn, we take some aa modulo nn, and create a chain a,a2,a3!,a4!a, a^2, a^{3!}, a^{4!}, etc. At each point, we take gcd⁡(aB!−1,n)\gcd(a^{B!}-1,n), hoping to get a nontrivial factor. We didn’t explain why it works. Can you reason out why it might work, at least heuristically?
  3. Write a small Sage for loop (use the Sage Sandbox) to implement Pollard p−1p-1 factoring. Use it to factor n=16637n=16637. Some hints so you don’t get stuck:
    1. remember to make aa into a value modulo nn, for example with a = Mod(2,n) (it will actually work with integers but they grow so fast it isn’t efficient).
    2. when you want to take a gcd of a value mod nn, you need to make it an integer again by putting a ZZ around it, so like gcd(ZZ(a)-1,n).
    3. start your loop at power 22 (squaring), not zero.
  4. With perfect timing, this discovery about the history of the NIST elliptic curves was released today! https://www.anthropic.com/research/ecdsa-curve-origins

DUE Friday, October 16th, 2026

Solutions: solutions to the daily post due October 14th (projective space) are posted. All daily post solutions are collected on the Archive page.

Test 2 solutions: Test 2 (Module 2) with solutions are posted (also linked from the Tests tab).

Tools: if you want more practice adding points by hand, the Practice Problems page makes random elliptic curve addition problems, and the Elliptic Curve Tools page and the Elliptic Curve Playground will check your work.

Relevant Textbook Sections:

5.5 (Elliptic Curve Discrete Logarithm Problem).

To Do:

On the elliptic curve E:y2=x3+x+1E: y^2 = x^3 + x + 1 modulo 1111, take P=(1,5)P = (1,5). Its multiples are:

kkkPkPkkkPkP
11(1,5)(1,5)88(0,1)(0,1)
22(3,3)(3,3)99(4,5)(4,5)
33(8,2)(8,2)1010(6,6)(6,6)
44(6,5)(6,5)1111(8,9)(8,9)
55(4,6)(4,6)1212(3,8)(3,8)
66(0,10)(0,10)1313(1,6)(1,6)
77(2,0)(2,0)1414∞\infty

Every point of EE appears in this table. Use it for all the problems below.

  1. How many points does EE have? Check that this satisfies Hasse’s bound.
  2. If you have an elliptic curve modulo 1313, what is the maximum and minimum number of points it could have?
  3. Using only the table (no slopes!), compute (3,3)+(8,9)(3,3) + (8,9) and (6,5)+(6,5)(6,5) + (6,5).
  4. Using the table, find −(4,6)-(4,6). Check that it agrees with what you know about negating a point geometrically.
  5. What is the order of 7P=(2,0)7P = (2,0)? Connect this to problem 5 from the daily post due October 12th. Which points of EE have order 77? Which have order 1414?
  6. (ECDLP) Find kk such that kP=(6,6)kP = (6,6). The table makes this a lookup. Explain why, for a curve modulo a 256256-bit prime, nobody can write down this table, and why being able to compute any single kPkP quickly (by double-and-add) doesn’t help you solve for kk.
  7. In the next class, we’ll define Elliptic Curve Diffie Hellman. But in class today, I already explained how the work we did in the first unit has an analogue for an elliptic curve. So you can already define this yourself! Write down what should be the Elliptic Curve Diffie Hellman protocol, and bring it to class to compare to what we do.

DUE Wednesday, October 14th, 2026

Posters: your group’s poster plan is due on canvas; check the Posters tab for the date and details, and make contact with your group and make a plan.

Lecture notes: my notes from today’s lecture on projective space are posted (also on the Notes/Videos page and the Archive).

Solutions: solutions to the daily post due October 12th (elliptic curve addition) are posted. All daily post solutions are collected on the Archive page.

Relevant Textbook Sections:

5.3 (Projective space).

To Do:

  1. Make sure you did last day’s daily post and compare to the solutions. Those computations are important; we’ll use them more. Notice in particular what to do if your slope has a denominator, or you are adding a point to itself.
  2. Give an example of four different vectors in R2\mathbb{R}^2 which become the same in PR1\mathbb{P}^1_\mathbb{R}.
  3. In the textbook (Section 5.3) and in lecture, we studied PF32\mathbb{P}_{\mathbb{F}_3}^2: the 2626 nonzero vectors in F33\mathbb{F}_3^3 fall into equivalence classes, each drawn in a different colour. Pick one colour, write out the vectors in that equivalence class, and check that they are equivalent. How many classes are there in total?
  4. Reward yourself with this video.
  5. Compute a full list of the elements in PF51\mathbb{P}_{\mathbb{F}_5}^1. Each element is an equivalence class (a bunch of different vectors that differ by scalar multiplication), so write out all the vectors in each equivalence class. (We did this for PF31\mathbb{P}_{\mathbb{F}_3}^1 in class.)
  6. In general, in PFpk\mathbb{P}_{\mathbb{F}_{p}}^k, how many vectors are in each equivalence class? For example, in the example from lecture, in PF31\mathbb{P}_{\mathbb{F}_{3}}^1, there were 22 in each class. What is the size of PFpk\mathbb{P}_{\mathbb{F}_{p}}^k (i.e. how many equivalence classes)?
  7. Find all the points of the affine equation y2=xy−1y^2 = xy - 1 on the “line at ∞\infty”. (Hint: we did this with the elliptic curve at the end of lecture: first homogenize the equation so all terms have the same degree, then break into Z=0Z=0 and Z≠0Z \neq 0 cases.)
  8. In lecture we saw that the elliptic curve E:Y2Z=X3+aXZ2+bZ3E: Y^2 Z = X^3 + aXZ^2 + bZ^3 has exactly one point on the line at ∞\infty, namely [0,1,0]=∞[0,1,0] = \infty. Check that the vertical line x=cx = c in the affine plane, written projectively as X=cZX = cZ, also passes through [0,1,0][0,1,0]. This is the precise sense in which “a vertical line meets EE at ∞\infty,” which is what makes P+(−P)=∞P + (-P) = \infty in the group law from last week.

DUE Monday, October 12th, 2026

Posters: the poster plan (title, abstract, references, group expectations) is due soon. Check the Posters tab for the dates and for what goes in the plan. Not in a poster group yet? Please come talk to me (after class, office hours, or email) so we can sort that out before the plan is due.

Lecture notes: my notes from Friday’s lecture on elliptic curves and the group law are posted (also on the Notes/Videos page and the Archive).

Solutions: solutions to the daily posts due September 28th and 30th and October 2nd, 5th and 7th are now posted (Sep 28, Sep 30, Oct 2, Oct 5, Oct 7). All daily post solutions are collected on the Archive page.

Tools: the Elliptic Curve Tools page (Sage) will add points for you, and the Elliptic Curve Playground draws the whole group as a picture. Do the problems below by hand first, then use these to check.

Relevant Textbook Sections:

5.1 (What is an elliptic curve?), 5.2 (Double points).

To Do:

  1. Compute the sum of the following two points on this elliptic curve. E:y2=x3+x+1E: y^2 = x^3 + x + 1 modulo 77. P=(0,1)P = (0,1) and Q=(2,2)Q = (2,2). Compute P+QP+Q.
  2. What is P+∞P + \infty on this curve?
  3. What is −P-P?
  4. Suppose, on the same curve, we want to compute the sum of QQ with itself. That means we need to find a tangent line! Compute Q+QQ+Q.
  5. Show that if P=(x,0)P=(x,0) is a point on an elliptic curve, then 2P=∞2P = \infty.
  6. On the curve y2=x3+2x+1y^2 = x^3 +2x + 1 modulo 55, compute the sum of the two points P=(3,3)P = (3,3) and Q=(1,2)Q = (1,2) by hand. Check that your answer is on the curve.
  7. On the curve y2=x3+2x+1y^2 = x^3 +2x + 1 modulo 77, try to compute the sum of the two points P=(0,6)P = (0,6) and Q=(0,1)Q = (0,1) by hand. The result should be the point at infinity (because these are inverses of each other), so the computation will “fail” — explain what fails that lets you know the result is the point at infinity.
  8. (A preview of things to come) On the curve y2=x3+2x+1y^2 = x^3 +2x + 1 modulo 3535, try to compute the sum of the two points P=(28,13)P = (28,13) and Q=(21,22)Q = (21,22) by hand. The result will fail. Explain why it fails, and how the failure factors 3535. Explain the relationship to the previous two problems.

DUE Wednesday, October 7th, 2026

Reminder: Test 2 (Module 2) is in class this Wednesday, October 7th (full period). The syllabus and review problems are on the Tests tab.

Test 1 solutions: Test 1 (Module 1) with solutions are posted (also linked from the Tests tab).

New tool: the Pollard Rho Demo page walks through Pollard’s ρ\rho method one step at a time: the tortoise-and-rabbit table from class, the ρ\rho-shaped picture of the sequence, and (behind the scenes) what happens modulo each prime factor.

Relevant Textbook Sections:

3.8.1 (Pollard’s rho factoring method).

To Do:

  1. Use Pollard’s rho method with f(x)=x2+1f(x) = x^2 + 1 and x0=2x_0 = 2 to factor n=8051n = 8051. You may use the Pollard Rho page or the Sage Sandbox for the arithmetic. Afterwards, check your table against the Pollard Rho Demo (it has 80518051 as a preset), and look at its pictures modulo 8383 and 9797: why did the method find 9797 and not 8383? Then try n=10403n = 10403 and n=455459n = 455459 on that page.
  2. Explain, using the birthday paradox, why Pollard’s rho typically finds a prime factor pp of nn after about p\sqrt{p} steps. (Hint: the sequence xi mod px_i \bmod p behaves like random values modulo pp, and you are waiting for a collision modulo pp.) If nn is an RSA modulus with two 100100-digit prime factors, about how many steps is that?

DUE Monday, October 5th, 2026

Reminder: Test 2 (Module 2) is in class on Wednesday, October 7th.

Relevant Textbook Sections:

3.8.3 (The role of squares in factoring).

To Do:

  1. Suppose p≡3(mod4)p \equiv 3 \pmod 4 and aa is a square modulo pp. The following observation gives a method to compute a square root of aa. Explain why our setup implies a(p−1)/2≡1a^{(p-1)/2} \equiv 1. Show that x=a(p+1)/4x = a^{(p+1)/4} satisfies x2≡a(modp)x^2 \equiv a \pmod p. Demonstrate the method with p=19p = 19 and a=6a=6. What goes wrong if you try the same formula for p=13p = 13 and a=10a = 10? (Note 62≡10(mod13)6^2 \equiv 10 \pmod{13}, so 1010 does have square roots.)
  2. Suppose nn is a product of two primes which are 3mod  43 \mod 4. Explain how, if you can factor nn, you could find square roots modulo nn using the last exercise. (Hint: CRT.)
  3. Find all four square roots of 7171 modulo 77=7⋅1177 = 7 \cdot 11. Hint: find the square roots modulo 77 and modulo 1111 separately, then combine them with CRT.
  4. Explain how, if you can find square roots modulo nn, this allows you to factor nn. (Find square roots means find all square roots.) Hint: this is just recalling something we’ve been discussing in class about square roots and factoring.
  5. Just a note: There are also more complicated ways to find square roots modulo primes that are 11 modulo 44. So the exercises above show that factoring nn is considered equivalent to finding square roots modulo nn.
  6. Find the square root(s), if any, of 33 modulo 1111 using the algorithm from the first example. Now draw the dynamical portrait of powers of 33 modulo 1111. Label each vertex as 3x=y3^x = y for whatever xx and yy, so each vertex can be interpreted as its value mod pp and its power of 33. Can you use this diagram to explain why the method works?

DUE Friday, October 2nd, 2026

New tool: the CRT Demo page shows the Chinese Remainder Theorem as two meshed gears (mod mm and mod nn) turning a big mod mnmn dial, along with the table from class. Try it with mm and nn coprime, and then with mm and nn sharing a factor.

Relevant Textbook Sections:

3.3 (Computing modular inverses), 3.4 (Sunzi’s Theorem (Chinese Remainder Theorem)).

To Do:

  1. Find the inverse of 3535 modulo 6161. Use the extended Euclidean algorithm. Verify your answer by multiplying out.
  2. Try out this Chinese Remainder Theorem problem, by hand: x≡3(mod244)x \equiv 3 \pmod{244} and x≡17(mod495)x \equiv 17 \pmod{495}. Show all the steps of the process, including the extended Euclidean algorithm. You can use the computer to do modular arithmetic for you (e.g. multiplying things if needed), but show the steps as if doing it by hand.
  3. Use any remaining time to do extra examples of CRT problems (you can make up your own by just putting in whatever numbers you want, as long as the moduli are coprime, and you can always check your answer by plugging it back into the original equations). The CRT Demo page can solve small ones too (moduli up to 20), so you can check your answers there.
  4. (AI suggestion) Sunzi’s original problem (c. 3rd–5th century): “There are certain things whose number is unknown. Counted by threes, two are left over; by fives, three are left over; by sevens, two are left over. How many things are there?” Solve it using CRT with three congruences.
  5. (AI suggestion) When the moduli are not coprime, CRT can fail. Does x≡3(mod6)x \equiv 3 \pmod 6, x≡5(mod8)x \equiv 5 \pmod 8 have a solution? What about x≡1(mod6)x \equiv 1 \pmod 6, x≡2(mod8)x \equiv 2 \pmod 8? Explain when such a system has a solution, and how many solutions it has modulo 2424.
  6. (AI suggestion) Another way to invert modulo a prime: by Fermat’s little theorem, a−1≡ap−2(modp)a^{-1} \equiv a^{p-2} \pmod p. Compute 3559 mod 6135^{59} \bmod 61 and compare with problem 1. Which method would you rather use for a 300-digit prime, and why? Which method still works modulo a composite nn?
  7. (AI suggestion) CRT speeds up RSA. Alice’s key from the last daily post is n=3233=61⋅53n = 3233 = 61 \cdot 53, e=17e = 17, d=2753d = 2753, and she receives the ciphertext c=2790c = 2790. Instead of computing cd mod 3233c^{d} \bmod 3233 directly, compute cd mod 61c^{d} \bmod 61 and cd mod 53c^{d} \bmod 53 (why may you reduce the exponent dd modulo 6060 and modulo 5252 respectively?), and then combine the two answers with CRT. Check your answer against the direct computation. Why is this faster?
  8. (AI suggestion) Håstad’s broadcast attack. Bob sends the same message mm to three friends, all using e=3e = 3, with public moduli n1=55n_1 = 55, n2=391n_2 = 391, n3=1189n_3 = 1189. Eve sees the ciphertexts c1=3c_1 = 3, c2=189c_2 = 189, c3=370c_3 = 370. Use CRT to find XX modulo n1n2n3n_1 n_2 n_3 with X≡ci(modni)X \equiv c_i \pmod{n_i} for each ii. Explain why XX must equal m3m^3 exactly (as an integer, not just modulo something), and recover mm. What does this suggest about sending the same message to several people with a small ee?

DUE Wednesday, September 30th, 2026

Relevant Textbook Sections:

3.1 (The Euclidean Algorithm), 3.2 (The Extended Euclidean Algorithm).

To Do:

  1. If you’d like a refresher on today’s material, watch my videos on the Euclidean algorithm and the Extended Euclidean algorithm (also on the Notes/Videos page). You can also play with the new Euclidean Algorithm page, which shows the algorithm as piles of dots and walks you through the recipe cards; use it to check your answers below.
  2. Compute the gcd of 135 and 170. Show all the steps of the algorithm.
  3. Consider the equation 7x+15y=17x + 15y = 1. Find an integer solution to this equation using inspection or trial and error. Using it, tell me the inverse of 77 modulo 1515 and the inverse of 1515 modulo 77. (This should require no computation, just look at your solution and have an aha moment!)
  4. Compute the gcd of 183 and 105. Show all the steps of the algorithm. Verify using the Sage Sandbox.
  5. Solve 183x+105y=3183x + 105y = 3 by expanding your work above into “recipe cards” as shown in class. Verify your answer using Sage’s command xgcd in the Sage Sandbox.
  6. What if we want to solve 3x+5y=03x + 5y = 0? The zero is the weird part. Then we don’t use the Euclidean algorithm.
    1. Give one solution by inspection (just find a clever one).
    2. Now give another one different from the first.
    3. Now give infinitely many.
    4. Find a solution to 3x+5y=13x + 5y = 1 (using the algorithm from class, or by guessing one).
    5. Now find infinitely many different solutions to 3x+5y=13x + 5y = 1. (Hint: use parts 1–4.)
  7. The goal of this exercise is to work out the runtime of the Euclidean algorithm (you may have seen this already, but do this without looking anything up). Think of the Euclidean algorithm as replacing one pair (a,b)(a,b) with a new pair (a′,b′)=(b,a−qb)(a',b') = (b, a - qb) at each step. For example, if we start with (a,b)=(183,105)(a,b) = (183,105), then we get (a′,b′)=(105,78)(a',b') = (105,78) at the next step.
    1. Show that, if b<a/2b < a/2, then b′<a/2b' < a/2.
    2. Show that, if b≥a/2b \ge a/2, then b′≤a/2b' \le a/2.
    3. Conclude that after two steps (a,b)→(a′,b′)→(a′′,b′′)(a,b) \rightarrow (a',b') \rightarrow (a'',b''), the size of the first entry has decreased by at least half.
    4. What is the runtime of the Euclidean algorithm?
  8. (AI suggestion) Run the Euclidean algorithm on 8989 and 5555 and count the steps. Now try some other pairs of numbers of about the same size. Why are consecutive Fibonacci numbers such slow inputs? How does this compare with your bound in the previous problem?
  9. (AI suggestion) Which integers cc can be written as 12x+42y12x + 42y for integers x,yx, y? Explain. Then find all integer solutions of 1071x+462y=211071x + 462y = 21.
  10. (AI suggestion) Use Sage to compute gcd⁡(212−1,218−1)\gcd(2^{12} - 1, 2^{18} - 1), and a few more like it, such as gcd⁡(2a−1,2b−1)\gcd(2^{a} - 1, 2^{b} - 1) for other a,ba, b. Guess a formula. Can you explain it by running the Euclidean algorithm “in the exponents”? (Hint: 2a−1=2a−b(2b−1)+(2a−b−1)2^{a} - 1 = 2^{a-b}(2^{b} - 1) + (2^{a-b} - 1).)

DUE Monday, September 28th, 2026

Friday’s lecture (September 25th) is pre-recorded. Watch it before Monday:

Solutions: solutions to the daily posts due September 14th and 25th are now posted (Sep 14, Sep 25). All daily post solutions are collected on the Archive page.

Relevant Textbook Sections:

2.11 (Signature Schemes), 3.6.5 (RSA Signature).

To Do:

  1. Watch the Friday, September 25th lecture (notes: part 1, part 2).
  2. Fix integers aa and bb with gcd⁡(a,b)=1\gcd(a,b) = 1, and suppose you have found integers x,yx, y with ax+by=1ax + by = 1 (for example, using the extended Euclidean algorithm). Explain why this single equation gives you both the inverse of aa modulo bb and the inverse of bb modulo aa at the same time. (Hint: reduce the equation modulo bb, and then modulo aa.)
  3. Alice’s RSA key has n=3233=61⋅53n = 3233 = 61 \cdot 53 and e=17e = 17. Find her private exponent dd, sign the message m=65m = 65, and then verify the signature as Bob. (The RSA Tools and other Sage functions may help.)
  4. Using only Alice’s public key, pick any ss you like (say s=100s = 100) and produce a message mm for which ss verifies as “valid”. Why doesn’t this worry Alice much in practice?
  5. Alice has signed m1=65m_1 = 65 (signature s1=588s_1 = 588) and m2=42m_2 = 42 (signature s2=3065s_2 = 3065). Without knowing dd, produce a valid signature on m1m2 mod nm_1 m_2 \bmod n. Can you think of a way this could be exploited by an attacker? How would signing h(m)h(m) instead of mm stop this attack?
  6. Visit the Hash Tools page and make sure you understand what a hash function is and how to use the tools on this page.
  7. Using the Hash Tools page, perform the SHA-256 hash on the string “friend” (try showing the digest both as hex and as bits). Then tick “Compare with a second message” and show the result in bits, change it to “fiend” (remove the r), and compare. Try some other pairs: united/untied, awesome/yuck, loooooooooong/short etc. How many of the 256 bits change? Is that what you’d expect?
  8. For the checksum “hash” h(m)=∑bits of m(mod2)h(m) = \sum \text{bits of } m \pmod 2 from lecture, find a preimage of 00, and find a collision with m=1010m = 1010.
  9. How about another toy hash which XORs together all the 8-bit blocks of mm to produce a single 8-bit digest? Break that one too (preimage and collision). Does this toy hash have the avalanche effect?
  10. Suppose you have a hash function that outputs kk-bit digests. Roughly how many random messages must you hash before you expect two with the same digest (a collision)? (See the Birthday Paradox Demonstration.) What does this give for MD5 (outputs 128 bits) and for SHA-256 (outputs 256 bits)? Does the birthday trick help you find a preimage?

DUE Friday, September 25th, 2026

Reminder: fill out the poster group form about poster groups (the link was in the last daily post).

Today’s lecture notes: Wednesday, September 23rd (also on the Notes/Videos page) — square roots and factoring, Miller-Rabin, Fermat factoring, and the quadratic sieve.

Friday’s lecture (September 25th) is pre-recorded and already up: the video and notes are on the Notes/Videos page.

Solution to the Kolmogorov complexity proof of the infinitude of primes (last daily post): it is written up in the textbook, Section 3.7 (Primality Testing).

Solutions: solutions to the daily posts due September 16th, 18th, 21st and 23rd are now posted (Sep 16, Sep 18, Sep 21, Sep 23). All daily post solutions are collected on the Archive page.

Relevant Textbook Sections:

3.7.2 (Miller-Rabin Primality Testing), 3.8 (Factoring), 3.8.3 (The role of squares in factoring), 3.8.4 (The quadratic sieve method), 3.6.3 (Short plaintext attack).

To Do:

  1. Use the Miller-Rabin primality test with a=2a=2 to determine if n=90751n=90751 is composite or probably prime. Show your steps.
  2. If it comes up probably prime, try it with a=3a=3. Show your steps.
  3. Next, possibly using the Miller-Rabin Tools, implement the Miller-Rabin primality test to test if n=3057601n = 3057601 is composite or probably prime, using the base 9990899908.
  4. Use Fermat Factoring to factor n=16080n=16080. Show the steps.
  5. I wish to factor n=38191n=38191. How do I do it, if I have the following info?
    1. 1962−n196^2 - n factors as 32⋅523^2 \cdot 5^2
    2. 2012−n201^2 - n factors as 2⋅5⋅13⋅172 \cdot 5 \cdot 13 \cdot 17
    3. 2142−n214^2 - n factors as 32⋅5⋅1323^2 \cdot 5 \cdot 13^2
    4. 2272−n227^2 - n factors as 2⋅33⋅13⋅192 \cdot 3^3 \cdot 13 \cdot 19
    5. 2292−n229^2 - n factors as 2⋅3⋅53⋅192 \cdot 3 \cdot 5^3 \cdot 19
    6. 2412−n241^2 - n factors as 2⋅32⋅5⋅13⋅172 \cdot 3^2 \cdot 5 \cdot 13 \cdot 17
    7. 2542−n254^2 - n factors as 34⋅52⋅133^4 \cdot 5^2 \cdot 13
  6. The euler-phi function gives φ(21733)=21420\varphi(21733) = 21420. Use this fact to factor 2173321733. (Hint: if n=pqn=pq, then knowing nn and φ(n)\varphi(n) tells you both pqpq and p+qp+q, so pp and qq are the two roots of a quadratic you can write down.)
  7. Factor n=31861n=31861 using the Quadratic Sieve Tools page to produce the relations you will need. You may need to expand your factor base or the number of relations the boxes produce.
  8. If you got lucky and got a single relation that did it, can you instead find a pair or larger combination of relations that do it?
  9. Many of the messages posted on the #ciphertexts channel during the RSA ciphertext chain were pretty small. Can you attack any of them using the “small message” attack demonstrated in class (the birthday attack on RSA: look for a collision between cx−ec x^{-e} and yey^e, which reveals m=xym = xy)? See also the textbook, Section 3.6.3 (Short plaintext attack).
  10. Optional: If you aren’t familiar with for loops and if statements in Python/Sage, please visit these super quick tutorials: Python: For Loops and Python: If Statements. Then play around with the Sage Sandbox to see if you can find Carmichael numbers. This might require writing a for loop in python.

Added Sept 25: solutions to this daily post (Miller-Rabin, Fermat factoring, factoring from relations and from φ(n)\varphi(n), the quadratic sieve, the small-message attack, and Carmichael numbers) are now posted: Solutions to Daily Due Sep 25.

DUE Wednesday, September 23rd, 2026

Reminder: Class on Wednesday, September 23rd is also on Zoom. The link is in Canvas.

Today’s lecture notes: Monday, September 21st (also on the Notes/Videos page). I’ll post the video link on discord once Zoom finishes preparing the recording.

Relevant Textbook Sections:

3.7 (Primality Testing), 3.7.1 (Fermat Primality Testing).

To Do:

  1. Using the modular arithmetic playground or other tools (such as the Sage Sandbox), find examples of xx and yy such that x2≡y2(modn)x^2 \equiv y^2 \pmod{n} but x≢±y(modn)x \not\equiv \pm y \pmod{n}. What do you notice about the nn for which you can find such examples?
  2. IF YOU ARE IN 4440: Think about forming a group of 2-3 people for a poster. Read the poster info in the Posters tab above. Reach out on discord, in person, etc., if you like to find a group that way. Then fill in the poster group form with your poster group situation so I can find out who is working with who or who needs help finding a team.
  3. IF YOU ARE IN 5440: You do an individual project instead of a poster. Send me an email with your thoughts on topic and your background and we can brainstorm.
  4. Think about your topic.
  5. Use the birthday paradox approximation formula (with the natural log e in it) to determine the minimal number of people who need to be in the classroom to have at least a 50% chance of a shared Ceres birthday. (You’ll need to look up how many earth days in a Ceres orbit.)
  6. Use Fermat’s Primality Test to detect whether 2001 and 2003 are composite or probably prime. Show your work (but you can use a calculator like Sage for the exponentiation). If one of them is probably prime, then try a different aa and explain what you learn.
  7. This problem outlines a proof that there are infinitely many primes from a CS perspective, using information theory (due to Chaitin). This proof is in the textbook, but the idea is to create it yourself without reading it there.
    1. Define the Kolmogorov complexity C(n)C(n) of an integer nn to be the length of the shortest computer program that will output nn in decimal form. (For concreteness, you can fix any programming language.) For example, the program for 27012701 might simply be print('2701'). This gives a trivial upper bound on C(n)C(n) of O(log⁡n)O(\log n). Explain why.
    2. For the numbers of the form n=10tn=10^t, prove that C(n)C(n) is bounded above by O(log⁡log⁡n)O(\log \log n) by giving an actual computer program.
    3. Suppose there are only finitely many primes p1,…,pkp_1, \ldots, p_k. The number kk is a constant. Show that for all nn, C(n)C(n) is bounded above by O(log⁡log⁡n)O(\log \log n), by using unique factorization.
    4. Prove that there must exist nn having C(n)≥log⁡nC(n) \ge \log n, by using a counting argument.
    5. Explain why this proves there are infinitely many primes.

Added Sept 23: solutions to this daily post (the x2≡y2x^2 \equiv y^2 hunt, the Ceres birthday problem, and Fermat’s test on 2001 and 2003) are now posted: Solutions to Daily Due Sep 23.

DUE Monday, September 21st, 2026

Reminder: Class on Monday, September 21st is on Zoom. The link is in Canvas.

Relevant Textbook Sections:

2.12 (ElGamal Encryption), 3.6 (RSA Encryption), 3.6.1 (RSA Example).

To Do:

  1. Suppose Oscar (a “man-in-the-middle”) intercepts and can modify a ciphertext on its way from Alice to Bob in El Gamal. Suppose he replaces the ciphertext (K,c)(K,c) with (K,sc)(K,sc) for some ss of his choosing. (Oscar doesn’t know any of the secrets, like the message or private keys, but he can modify things.) What message will Bob decrypt? This exercise shows that Oscar can manipulate the message in a predictable way, without knowing what the message is. This is called “malleability”. This is an “active” attack, meaning that Oscar interacts with the protocol (changes things which are being sent during the protocol). Can you think of a way to fight malleability? How could you modify El Gamal to prevent this attack?
  2. An RSA ciphertext chain!
    1. If you need a review of RSA, check the textbook (Section 3.6, with an explicit example in 3.6.1). For what follows, the Sage Sandbox page should be useful, as may be the RSA Tools page. These pages show how to do operations like modular inverse, exponentiation, and euler phi function in Sage. You can use basic number theory functions in Sage to do all your computations.
    2. First, set up your public and private key.
      1. Choose two 8-decimal-digit primes and form their product nn. You can get primes out of Sage using the next_prime() function. So pick a number in the ballpark you want (maybe using randint()) and use next_prime() to get the next smallest integer which is prime.
      2. Compute φ(n)\varphi(n). Note that euler_phi() will do this for you in Sage, but it’s better to use the formula (p-1)*(q-1) because at cryptographic size, Sage would not return an answer, since euler_phi(n) would try to factor n.
      3. Choose an encryption exponent ee that is positive and less than φ(n)\varphi(n).
      4. Compute your decryption exponent dd. It’s possible this will fail (e.g., if ee is not invertible!). If this error gets annoying (depends on your φ(n)\varphi(n)), you could try using next_prime() to get a likely invertible ee. (Concept check: why is a prime ee more likely to work?)
      5. Keep dd safe (along with pp and qq, nn and φ(n)\varphi(n), just in case) in a file on your computer. The dd is your private key information; be sure also to keep p,q,φ(n)p,q, \varphi(n) away from prying eyes.
      6. Reveal your public key nn and ee on the discord #public-keys channel (“My RSA Public Key Is (n,e)=(…,…)”).
    3. Create a secret message which is at most 6 letters long. It should answer “What’s something awesome?” Please don’t make it longer or this exercise won’t work.
    4. Turn it into an integer using the Text to Integer tool. (There’s an Integer-to-Text tool on the same page to undo this process.)
    5. Now find someone else who has posted their public key (the most recent one before yours), and encrypt your message to that person. Post it on the #ciphertexts channel for them (use @theirname to alert them). Note: this should be one residue modulo their public nn.
    6. When someone posts a message for you, decrypt it and announce the result using discord’s “spoiler” feature.
    7. You can turn in on canvas a screenshot of your discord result(s).

Added Sept 23: solutions to this daily post (El Gamal malleability and the RSA ciphertext chain worked end to end) are now posted: Solutions to Daily Due Sep 21.

DUE Friday, September 18th, 2026

Relevant Textbook Sections:

2.12 (ElGamal Encryption) for review.

To Do:

  1. Do the El Gamal ciphertext chain if you haven’t already (last daily post).
  2. Suppose that x2≡y2(modn)x^2 \equiv y^2 \pmod n but x≢±y(modn)x \not\equiv \pm y \pmod n. Explain how this can help you factor nn. Hint: Factor a difference of squares.
  3. Look at the modular arithmetic playground. Try some different functions and look at the dynamical portraits. Now, click on the modulus and use the arrow keys to go through different moduli. Look for patterns and see if you can predict whether or not nn is prime, or anything about its factorization, from studying the patterns. Do certain patterns imply that the modulus is prime or composite?

Added Sept 23: solutions to this daily post (how x2≡y2x^2 \equiv y^2 factors nn, and the patterns in the dynamical portraits) are now posted: Solutions to Daily Due Sep 18.

DUE Wednesday, September 16th, 2026

Reminder: Test 1 (Module 1) is in class on Wednesday, September 16th.

Relevant Textbook Sections:

2.12 (ElGamal Encryption), and everything in Module 1 for review.

To Do:

  1. Review for Test 1! Click the Tests tab for the syllabus and review problems. The Practice Problems page now generates (with solutions) modular exponentiation, towers of exponents, baby-step giant-step, index calculus and Diffie-Hellman problems. There is nothing to hand in on canvas for this post.
  2. Optional: El Gamal Encryption Chain! We will use the same prime and generator as we did for Diffie-Hellman (p=1015+37p = 10^{15}+37, g=2g = 2). This is set up on the Diffie-Hellman Tools page. Do the following:
    1. If you have not already made a public key for Diffie-Hellman Key Exchange, then set up a Diffie-Hellman private and public key for yourself. Publish the public key on the #public-keys channel on discord. Note your public and private key down for safekeeping. If you’ve lost your private key, delete your old key and do this again.
    2. Choose an at most 6 letter word as a message. It should be a polite, recognizable english word, so the decrypter will be able to tell they’ve done this correctly. It should answer, in some fashion, the question “Best food?” Turn it into an integer using the Text to Integer tool. Make notes on paper.
    3. Find the Diffie-Hellman public key immediately before yours in the #public-keys channel (if this doesn’t exist, use the most recent public key), and use that public key to encrypt your word to that person. Keep notes on paper of the key steps.
    4. Post your ciphertext publicly for that person on the #ciphertexts channel. Use @username. It should consist of two numbers, which we called (K,c)(K, c).
    5. When you receive a message from someone on the channel, decrypt it. Hopefully it is an english word. If it is, yay! Respond on the channel to that person to tell them the decryption you got. Keep notes on paper of the key steps.
    6. Challenges for fun:
      1. Break someone else’s message! Use any algorithm. Let me know if you succeed on discord!
      2. Get your friend to send two messages to the same person using the same ephemeral key. Break this!

Added Sept 23: solutions to this daily post (the optional El Gamal encryption chain worked end to end, plus the two challenges: breaking a key by Pohlig-Hellman and baby-step giant-step, and the repeated ephemeral key) are now posted: Solutions to Daily Due Sep 16.

DUE Monday, September 14th, 2026

Reminder: Test 1 (Module 1) is in class on Wednesday, September 16th.

Relevant Textbook Sections:

2.10.3 (Index Calculus), 2.10.4 (Runtime), and for review, 2.10.1 (The Baby-Step Giant-Step Algorithm) and 2.12 (ElGamal Encryption)

To Do:

  1. Reminder: the first test is in class on Wednesday, September 16th, 2026 (Module 1). See the Tests page for the syllabus and review problems.
  2. Solutions to the last daily post (the parity of the discrete log, baby-step giant-step for 51=2x(mod83)51 = 2^x \pmod{83}, the tower 2(32026)(mod33)2^{(3^{2026})} \pmod{33}, and the runtime analysis) are now posted: Solutions to Daily Due Sep 11. All daily post solutions are collected on the Archive page.
  3. To Know: If you’re interested in the runtime of the Index Calculus, I have more detail in the textbook (Section 2.10.4). Additionally, here are some course notes that cover it in more detail (from Andrew Sutherland’s MIT course on elliptic curves). This may be an interesting topic for a graduate student project: runtime for index calculus and/or index calculus improvements mod pp and/or in other finite fields.
  4. Solve the discrete logarithm problem for p=131p=131, g=2g=2, h=17h=17, using the Index Calculus method. You may use the Index Calculus Tools and Sage’s modular arithmetic and plain arithmetic computations to avoid by-hand computations, but please solve the linear system by hand (i.e. choosing which equations to subtract from which etc.). Note: this is a randomized algorithm, so you will get different relations than someone else, or next time you run the tool. If you are not finding a very nice linear system, just try to get some more relations and pick simple manageable ones.
  5. An awkward linear system. Keep p=131p = 131 and g=2g = 2, and write L(a)L(a) for the discrete log of aa base 22 (so L(a)L(a) is only defined modulo p−1=130p - 1 = 130). One relation the tool can hand you is 214≡9=32(mod131)2^{14} \equiv 9 = 3^2 \pmod{131}, which says 14≡2L(3)(mod130)14 \equiv 2L(3) \pmod{130}.
    1. Suppose you “divide by two” to conclude L(3)=7L(3) = 7. Check this by computing 27(mod131)2^7 \pmod{131}. Is it 33?
    2. Explain what went wrong. How many solutions yy does 2y≡14(mod130)2y \equiv 14 \pmod{130} have, and what are they? Which one is L(3)L(3)?
    3. Find the parity of L(3)L(3) using the test from the last daily post (raise 33 to the 6565th power modulo 131131). Explain how this picks out the right solution in part (2) without any further checking.
    4. Here are three more relations: 28≡532^{8} \equiv 5^3, 212≡5⋅72^{12} \equiv 5 \cdot 7, and 238≡3⋅7(mod131)2^{38} \equiv 3 \cdot 7 \pmod{131}. Use them to find L(5)L(5), L(7)L(7) and L(3)L(3) without ever dividing by an even number (you will need an inverse modulo 130130), and check that your L(3)L(3) agrees with part (3).
    5. In general, which integers are safe to divide by (i.e. multiply by an inverse) when solving relations modulo p−1p-1?
  6. Runtime comparison. The (heuristic) runtime of the Index Calculus modulo pp, with a well-chosen factor base, is about eln⁡p⋅ln⁡ln⁡pe^{\sqrt{\ln p \cdot \ln \ln p}} operations (Section 2.10.4), while Baby-Step Giant-Step takes about p\sqrt{p} operations.
    1. Compute both quantities (to two significant figures, in scientific notation) for a 2020-digit prime, a 4040-digit prime, and a 100100-digit prime.
    2. Suppose 102010^{20} operations is the most an attacker can afford. About how many digits must pp have to be safe against Baby-Step Giant-Step? Against the Index Calculus? (Treat the two formulas as exact; the real constants are different, but the moral is the same.)
    3. Explain in a sentence why the Index Calculus is called subexponential: compare eln⁡p⋅ln⁡ln⁡pe^{\sqrt{\ln p \cdot \ln \ln p}} with pε=eεln⁡pp^{\varepsilon} = e^{\varepsilon \ln p} for a fixed ε>0\varepsilon > 0 as p→∞p \to \infty.
  7. Remember to upload to canvas!

Added Sept 25: solutions to this daily post (the Index Calculus for 2x≡17(mod131)2^x \equiv 17 \pmod{131}, the awkward linear system, and the runtime comparison) are now posted: Solutions to Daily Due Sep 14.

DUE Friday, September 11th, 2026

Relevant Textbook Sections:

2.4.4–2.4.5 (The theorems of Euler and Fermat; Using Euler’s φ\varphi function), 2.7 (Runtimes and Big-Oh notation), 2.8–2.9 (The Discrete Logarithm and the Discrete Logarithm Problem), 2.10 (Parity of discrete log), 2.10.1 (The Baby-Step Giant-Step Algorithm)

To Do:

  1. Reminder: the first test is in class on Wednesday, September 16th, 2026 (Module 1). See the Tests page for the syllabus.
  2. Solutions to the last daily post (the big-oh comparisons and the baby-step giant-step computation) are now posted: Solutions to Daily Due Sep 9. All daily post solutions are collected on the Archive page.
  3. A bit of math practice that shows that the parity (even or oddness) of the discrete log can be discovered easily. Let pp be an odd prime number.
    1. Show that if ab≡0(modp)ab \equiv 0 \pmod p then a≡0(modp)a \equiv 0 \pmod p or b≡0(modp)b \equiv 0 \pmod p.
    2. Use part (1) on the expression (x+1)(x−1)(x+1)(x-1) to show that the only two solutions to x2≡1(modp)x^2 \equiv 1 \pmod p are 11 and −1-1.
    3. Let gg be a primitive root mod pp. Show that g(p−1)/2≡−1(modp)g^{(p-1)/2} \equiv -1 \pmod p. (This uses the previous part.)
    4. Suppose h≡gx(modp)h \equiv g^x \pmod p is given to you (but xx is not known). Show how you can determine if xx is even or odd. Hint: Raise the equation h≡gx(modp)h\equiv g^x \pmod p to the (p−1)/2(p-1)/2 power and see what you get using the previous part.
    5. Note that 22 is a primitive root modulo 1111. Use the test above to determine if xx so that 2x≡5(mod11)2^x \equiv 5 \pmod{11} is even or odd.
    6. Check whether you are correct by finding xx (by any method).
    7. Comment on the runtime of this test for the parity of xx.
    8. Comment on whether parity of a discrete log is well-defined modulo nn. Why is it ok for odd primes pp?
  4. Review for Test 1. Use the Baby-Step-Giant-Step algorithm to solve the discrete logarithm problem 51=2x(mod83)51 = 2^x \pmod{83}. (22 is a primitive root modulo 8383.) Present both lists, labelled so it is clear where each entry comes from, identify the collision, and explain how it gives xx. Then check your answer. You may use the tools on the Baby-Step Giant-Step page or the Sage Sandbox to generate the lists. Or do some by hand, for practice!
  5. Review for Test 1. Compute 2(32026)(mod33)2^{(3^{2026})} \pmod{33} “by hand” (calculator is ok for multiplications and reductions, but show all steps). Remember to check the coprimality conditions that Euler’s theorem needs, each time you use it.
  6. A runtime analysis. Here is a search problem: the input is two integers NN and tt. The goal is to decide whether tt appears in the list 13+1,23+2,33+3,…,i3+i,…,N3+N1^3+1, 2^3+2, 3^3+3, \ldots, i^3+i, \ldots, N^3 + N. Two algorithms: Linear search computes the list from the beginning, comparing each computed entry to tt, and stops when it finds tt or passes it. Binary search computes the middle entry, compares tt to that middle entry, discards the half of the list which cannot contain tt, and repeats on the half that remains, until it finds tt or runs out of list.
    1. Determine the size of the input to this problem (in bits), as a function of NN.
    2. Determine the runtime of each algorithm, in big-oh notation, as a function of the input size. Count a comparison of two integers as costing a number of bit operations proportional to their length in bits.
  7. Remember to upload to canvas!

Added Sept 11: solutions to this daily post (the parity of the discrete log, baby-step giant-step for 51=2x(mod83)51 = 2^x \pmod{83}, the tower 2(32026)(mod33)2^{(3^{2026})} \pmod{33}, and the runtime analysis) are now posted: Solutions to Daily Due Sep 11.

DUE Wednesday, September 9th, 2026

Relevant Textbook Sections:

2.7 (Runtimes and Big-Oh notation), 2.8–2.9 (The Discrete Logarithm and the Discrete Logarithm Problem), 2.10.1 (The Baby-Step Giant-Step Algorithm)

To Do:

  1. Reminder: the first test is in class on Wednesday, September 16th, 2026 (Module 1). See the Tests page for the syllabus.
  2. Solutions to the last daily post (a complete worked example of the Diffie-Hellman exercise, with numbers you can try in the tools) are now posted: Solutions to Daily Due Sep 4. All daily post solutions are collected on the Archive page.
  3. For each of the following pairs of functions, determine if f=O(g)f=O(g) and if g=O(f)g=O(f).
    1. f(x)=∣sin⁡(x)∣f(x) =|\sin(x)| and g(x)=1/2g(x) = 1/2.
    2. f(x)=2xf(x) = 2^x and g(x)=3xg(x) = 3^x.
  4. Use the Baby-Step-Giant-Step algorithm (and show all steps) to solve the discrete logarithm problem 34=3x(mod113)34 = 3^x \pmod{113}. You may use Sage’s functionality to compute the lists, including the tools on the Baby-Step Giant-Step page if you want to (ask for help on discord if you need some explanation of the page), so it shouldn’t involve much work by hand. But please present the solutions tidily and in a well-explained and well-labelled way (indicate where each term in each list comes from, not just the value you get), so the algorithm is evident.
  5. If you are so inclined, try to break one of the ciphertexts on discord from our Diffie-Hellman Key Exchange.
  6. Remember to upload to canvas!

Added Sept 9: solutions to this daily post (the big-oh comparisons and the baby-step giant-step computation) are now posted: Solutions to Daily Due Sep 9.

DUE Friday, September 4th, 2026

Relevant Textbook Sections:

2.4.7 (Summary of Multiplicative Structure in the unit group), 2.5 (Diffie-Hellman Key Exchange)

To Do:

Added Sept 4: solutions to this daily post (a complete worked example of the exchange, with all the numbers) are now posted: Solutions to Daily Due Sep 4.

  1. Notice: the first test will be in class on Wednesday, September 16th, 2026 (Module 1). See the Tests page for the syllabus.
  2. Solutions to the last two daily posts are now posted: Solutions to Daily Due Aug 31 and Solutions to Daily Due Sep 2. Check your work against them. All daily post solutions are collected on the Archive page.
  3. Watch the video “Diffie-Hellman Key Exchange Exercise” (~16 min) [ link here ], which is a tutorial to accompany the following exercise. In the video, I demonstrate how to use the course website tools (on this website) to put your Diffie-Hellman public key up on the discord server, and send a message to someone there. Here are the written notes from that video.
  4. Here are the full written instructions: you will perform a Diffie-Hellman Key Exchange in order to send a message to someone. Big picture: you’ll do a Diffie-Hellman Key Exchange to make a shared secret and then use that shared secret as a key for a very simple encryption (a sort of Caesar Cipher or One-Time Pad):
    1. Create a secret message which is at most 6 characters long. It should answer “Why CU?” Please don’t make it longer or this exercise won’t work.
    2. Turn it into an integer using the Text to Integer tool. (This turns it into an integer by writing the letters in ASCII and making an integer base 255 with those digits. There’s an Integer-to-Text tool on the same page to undo this process.)
    3. We will use prime p=1015+37p=10^{15}+37, and its primitive root g=2g=2. The first box in the Diffie-Hellman Tools page will initialize this modular ring for you.
    4. Use the Diffie-Hellman Tools (second box) to find a random secret aa. We’ll call this your secret key. Keep it secret and SAVE IT, maybe in your underwear drawer. (Joking! — actually safer if you copy it into a text file on your computer, because if you write it by hand you’ll make an error.)
    5. Compute gag^a using the Diffie-Hellman Tools third box appropriately (no need to do this by hand!) We’ll call this your public key.
    6. Announce your public key on discord #public-keys. Be sure to explain this is your “Diffie-Hellman Public Key” (there will be other types later).
    7. Find someone else’s public key (gbg^b) on discord (the most recent public key on the #public-keys channel is best, so everyone gets to have part of the fun). Let’s call that other person Bob. Use it to generate your shared secret (gabg^{ab}) with Bob (you’ll need your secret key for this). Again, you can use the third box in the Diffie-Hellman Tools page to do the computations (no need to work by hand).
    8. Add the shared secret to your message mod pp. Announce the result on discord in the #ciphertexts channel as the secret message for Bob. They can find your public key on the #public-keys channel. Your post might look like “My Diffie-Hellman message for @soandso is X.”
    9. When someone sends you a secret message, figure out how to decrypt it and announce the result (so you can check it worked!). You may need to use the Diffie-Hellman Tools and the Text to Integer converter.
  5. Remember to upload to canvas!

DUE Wednesday, September 2nd, 2026

Relevant Sections of Textbook

  • 2.2.9 (Invertibility)
  • 2.2.10 (unit group)
  • 2.4 (Multiplicative dynamics)

To Do:

Added Sept 2: solutions to the daily due Aug 31 are now posted: Solutions to Daily Due Aug 31.

  1. In class, we proposed a formula φ(n)=n(1−1/p1)(1−1/p2)⋯(1−1/ps)\varphi(n) = n(1 - 1/p_1)(1-1/p_2)\cdots(1-1/p_s) when nn is a product of distinct primes pip_i. Verify this for n=15n = 15 and n=30n=30 by comparing to your computations of φ\varphi from the last daily post.
  2. Write me a few sentences “check-in”; how do you feel the class is going? What are challenges, what can I do to help with those?
  3. Use successive squaring to compute 3133(mod1009)3^{133} \pmod{1009}. You can use a calculator for the multiplications/reductions, but show all steps of the algorithm. If you learned about double-and-add (see last daily post), you can use that if you prefer.
  4. Some fun modular arithmetic, part one:
    1. Verify that 77 is coprime to 1212 (factor them both).
    2. Compute φ(12)\varphi(12).
    3. Explain what Euler’s theorem says about powers of 77 modulo 1212. Why did we check the last two things?
    4. Compute 7115(mod12)7^{115} \pmod{12} by hand using Euler’s Theorem. Calculator is ok for multiplications and reductions, but show all steps.
  5. Some fun modular arithmetic, part two:
    1. Verify that 5959 is coprime to 2626 (factor them both).
    2. Compute φ(26)\varphi(26) (it’s important you get this right, check your answer with the Sage Sandbox (the euler_phi function is listed there)).
    3. Compute 59(7115)(mod26)59^{(7^{115})} \pmod{26} by hand (this may use the previous problem…)
  6. Use what you learned from the last few problems to compute 3(11200006)(mod50)3^{(11^{200006})} \pmod{50} “by hand” (this will always mean calculator is ok for multiplications and reductions, but show steps).
  7. Observe (verify) that φ(15)=8\varphi(15) = 8 and 38=6(mod15)3^8 = 6 \pmod{15}. (You can check these on Sage or by hand or both.) This looks like it contradicts Euler’s Theorem. Why is it ok?
  8. Remember to upload to canvas!

DUE Monday, August 31st, 2026

To Do:

  1. Solutions to the last daily post (the one due today) are now posted: Solutions to Daily Due Aug 28. Check your work against them. All daily post solutions are also collected on the Archive page.
  2. Quick review question: What is the inverse of 7 mod 11? What is the inverse of 7 mod 14? (Watch for trick questions!)
  3. For each of the following nn, compute the set (Z/nZ)∗(\mathbb{Z}/n\mathbb{Z})^* and therefore its cardinality φ(n)\varphi(n): n=12n=12, 1515, 1616, 2626, 2727, 3030.
  4. Practice and reasoning with modular arithmetic with a cryptography flavour. If the affine cipher key (α,β)(\alpha, \beta) is ‘badly chosen’ (i.e. α\alpha may not be invertible), then bad things can happen. Find an example where two different plaintexts encrypt to the same ciphertext. (The plaintexts don’t need to be english, they can just be any letters.)
  5. Some abstract thinking about modular arithmetic. Prove (explain your reasoning) that:
    1. If you take successive powers of aa mod nn, i.e. a,a2,a3,a4,a5,⋯a,a^2,a^3,a^4,a^5,\cdots, that eventually you will get a repeat (the same residue will appear more than once, e.g. a2a^2 might equal a7a^7). (Hint: finiteness)
    2. If aa is invertible, then some power of aa is 11. (Hint: use the first part somehow.)
    3. Can you find an example residue aa modulo nn for some aa and nn where no power of aa is ever 11? You might want to mess around with the various Sage tools on this site.
  6. Practice with modular arithmetic in the context of matrices, with a cryptography flavour.
    1. The Hill cipher (with 2×2 matrices) was used to encrypt the plaintext SOLVED to get the ciphertext GEZXDS. (Two letters were encrypted at a time.) Can you find the Hill cipher key?
    2. Consider Hill cipher with the matrix (1234)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} modulo 2626. Can you find two plaintexts that encrypt to the same ciphertext? (The plaintexts don’t need to be english, they can just be any letters.) What’s wrong with this matrix (why isn’t encryption injective?)?
  7. If it sounds fun, learn a useful new algorithm! The Double-And-Add algorithm allows for fast exponentiation, among other things; it’s a sort of refinement of successive squaring.
    1. First, watch this video (6:09) which gives a general algorithm.
    2. Use the double-and-add algorithm of the video (by writing 148 in binary) to demonstrate an efficient way to compute 21482^{148}.
    3. Program it if you feel like it.
  8. Remember to upload to canvas!

DUE Friday, August 28th, 2026

To Do:

  1. Solutions to the last daily post (the one due today) are now posted: Solutions to Daily Due Aug 26. Check your work against them. All daily post solutions are also collected on the Archive page (when I’m on top of things!).
  2. CIPHERTEXT CHAIN! This time with affine cipher.
    1. Come up with a short (one word) answer to the question “What’s the coolest math?” This is your plaintext.
    2. Choose a key (α,β)∈(Z/26Z)2(\alpha,\beta) \in (\mathbb{Z}/26\mathbb{Z})^2. Make sure your choice is suitable as a key, as we discussed in class.
    3. Encrypt the plaintext with affine cipher (by hand, using the cryptography tools sheet if you like). This gives you your ciphertext.
    4. Post your ciphertext on the discord channel #ciphertexts, along with the key.
    5. Choose the most recent user’s post (besides yours) from #ciphertexts, and decrypt it (by hand).
    6. Post the answer in the form “So-and-so thinks the coolest math is…”. Use discord’s “spoiler” feature to hide your answer, in case other students want to practice, or end up using the same ciphertext (this never works quite perfectly).
  3. Suppose you eavesdrop on your little sister’s communications, and she is using affine cipher. Her ciphertext is CRWWZ. You know she starts every message she writes with “HA” (she’s weird that way). Decrypt the message. Explain how you did it.
  4. Find the inverse (if it exists) of: 2(mod17)2 \pmod{17}, 8(mod11)8 \pmod{11} and 3(mod15)3 \pmod{15}. If it doesn’t exist, explain why.
  5. Come up with the fastest way to compute 35193^{519} modulo 1111 by hand. That is, count the multiplications you need to do in your full solutions (you can’t use secret knowledge about mod 11 for example, you have to compute anything you plan to use), and try to minimize that number by being clever about your method. It should be doable by hand (i.e., don’t do 500+ multiplications!!) Post the number of multiplications you have to do (but not your secret sauce) in the #daily-collaboration channel, as a sort of friendly competition.
  6. Remember to upload to canvas!

DUE Wednesday, August 26th, 2026

To Do:

  1. Please check the previous daily post (scroll down) and take care of the missing administrative items you haven’t done.
  2. Please make sure you are now fully aware of the way daily posts work (you set aside an hour; you upload evidence of your worktime). We will have discussed this in class.
  3. The main activity for this daily post is to watch my video “Modular Arithmetic: User’s Manual” (9:22 mins:secs; link above requires CU access, no ads; also on YouTube here), and do the accompanying self-check worksheet. Please be sure to show your work on the last problem. (Note: you don’t need to print; you can work on a separate sheet of paper if desired; in general this type of thing is true, since you are just showing evidence of your work, I’m not picky.)
  4. Explain how XOR can be described in terms of modular arithmetic.
  5. For the course, we will use Sage Mathematics Software for computations. Here’s a Sage worksheet that shows how to use Sage as a calculator for modular arithmetic. Check it out (do each computation by hand (except the last three, which we haven’t discussed yet, concerning inverses/dividing) and then compare to the computer output). Note: worksheets on the course website do not save your data.
  6. Create an example modulo 10 of residues a,b,ca,b,c such that a≢b(mod10)a \not\equiv b \pmod{10} and c≢0(mod10)c \not\equiv 0 \pmod{10}, but ac≡bc(mod10)ac \equiv bc \pmod{10}. Explain why this means you “can’t always cancel in modular arithmetic.”
  7. Compute 1012(mod11)10^{12} \pmod{11} by cleverness. Check your answer with Sage. Verify that 10≢1012(mod11)10 \not\equiv 10^{12} \pmod{11}. Explain why this shows you “can’t take mod up in the exponent”.
  8. Catch up on the last daily post (classical ciphers), if needed. While you’re doing this, think about how each of them can be described in terms of modular arithmetic. You can check your decryptions against the Solutions to Daily Due Aug 24 (AI generated) (problems 9–12).
  9. Upload a record of your work today to canvas (as always).

DUE Monday, August 24th, 2026

Today’s tasks are mostly reading and learning by reading. As you read the textbook, you will find exercises scattered through the text. Part of reading the text for full understanding is doing these exercises until you are very confident in your understanding.

Please read the full list of tasks before you begin. The final task (uploading to canvas) should happen even if you don’t finish everything else.

To Do:

  1. Log into canvas and follow the instructions to get set up on Discord, which we will use during the semester.
  2. Log into canvas and fill out the video waiver (I record my screencast during lectures for future students).
  3. Log into canvas and fill out the AI questionnaire (I’d like to know your AI opinions).
  4. Print out the Self-Eval Sheet, or save a copy you can edit on your device. You will fill this out each time you do your daily post work. It should be self-explanatory (read the instructions!).
  5. Read the pages which have tabs across the top of this website (About, Archive, Notes/Videos, …) so you know how the course is run. This is the syllabus and I won’t use class time to go over it. This is important.
  6. Go to the Textbook link (top left on this site) and view the textbook. If you would like to use the (experimental) AI overlay, you have to enter the code that I sent you in canvas mail, which has a $5 starting budget (AI costs money). Once you put that in, it is stored as a cookie. Then you can simply highlight a passage of interest with your mouse, and you will find different options, like “show me an example” or “chat”. Note: there is no expectation of privacy. Whatever you find useful, you can save as a margin note, and then it is viewable to everyone who uses the textbook. (I moderate these.) If you don’t want the AI overlay, you use it in “Static Mode” and it’s a traditional (human-written by me!) textbook with built-in interactives.
  7. READ Chapter 1 of our text, up to the end of Section 1.3 (including Enigma machine), doing the exercises. Your goal is to understand how each of these old ciphers works, so that you can encrypt and decrypt by hand. And to have a bit of a historical viewpoint.
  8. CIPHERTEXT CHAIN! Encrypt a message (a quote you like), using a cipher of your choice (tools are in the textbook as interactives) and post it to the Discord #ciphertexts channel. Choose the ciphertext posted by the last person on that channel, to try to decrypt. Try to guess which cipher it was encrypted with, before you try to decrypt. Feel free to report out how you decrypted (by hand, using the provided tools, whether you guessed right…). This is for fun and to get used to discord and each other. Don’t sweat it.
  9. Decrypt the following Vigenère cipher by hand, showing work, using the key “CRYPTO”: geagrdvzmc
  10. Decrypt the following Caesar cipher by hand, showing work, using the key “D” (that is, A becomes D): hw wx euxwh
  11. Decrypt the following ADFGVX cipher by hand, showing work, using the Polybius square shown in the textbook and column order 1324: VDDGXDXVGGAXAAAA (Hint: we didn’t really talk about decryption, so you’ll have to figure out how to reverse engineer it! Explain your ideas!)
  12. Decrypt the following one-time pad message (in binary) by hand, using key “001101”: 100100
  13. At the end of each daily post, collect evidence of your work, including your self-eval sheet, and upload it (PDF, jpg, etc.) to the appropriate Daily Post dropbox in Canvas. This is not graded. But it is our joint record of your hard work throughout semester. This is important.

Welcome to Cryptography! (Fall 2026)

Hello class and welcome!

I’m your professor, Dr. Katherine Stange.  A little about me.  My job as a professor is half teaching and half research.  My research is in number theory and cryptography, so I especially enjoy this course.  When I’m not working, I like to cycle up Flagstaff, or anywhere that is uphill.

I hope you’re going to find this class challenging but fun and exciting.  This class has some features I want to make sure you are aware of up front:

  • The focus on the course is on the mathematical algorithms underpinning modern cryptography and cryptanalysis, mostly public-key cryptography, as well as some coding theory.  We will tie the algorithms we study to real-world implementations and events.  Topics will include basic number theory including elliptic curves and finite fields, current public-key cryptosystems, basic quantum computing and quantum cryptography, post-quantum (quantum-safe) cryptography, and coding theory.
  • This is a mathematics course, and you will be expected to reason mathematically about mathematical objects, follow and understand proofs, know definitions, be able to reason out examples, predict the outputs of algorithms and computations, etc.   However, this course will not emphasize proof-writing.  You certainly do not need to be a math major, but you need to have some mathematical/analytical thinking skills.  There are few explicit mathematical pre-requisites, but linear algebra will help a lot.
  • I will teach and expect some basic python programming, so we can implement algorithms.  This will be modular, so if you have coding skills already, you won’t need to “redo” your basic skills.
  • I expect you to find 1 hr between each class for homework.   There will be “daily posts”:  per lecture assignments.  The rest of your study time will be discretionary and flexible.
  • Assessment is in-class.  Homework is self-reported and solutions posted; it is not graded. Your understanding is assessed through in-class tests.
  • We will use discord.  Please plan to check discord and this website regularly for updates.  Things move fast.
  • There will be a poster project in small groups.  This is a self-guided research project into a related topic in the course.
  • Students taking 5440 (instead of 4440) will replace the poster project with more extensive individual projects.

To Do:

  • To learn all about the course, examine the tabs in the header menu.  These tabs together form the syllabus.
  • Log into canvas for access to the discord sign up link.