| Algorithm 2: Quantum key recovery attack. |
| Input: and V |
| Quantum oracle: |
| 1: Set the quantum state to . |
| 2: Make a quantum Fourier transform on the first and third registers. |
| 3: Make a quantum oracle query and obtain (by writing ). |
| . |
| 4: Discard the last two registers and apply the quantum Fourier transform. |
| 5: Measure the first register and output . |