•
4 min read
Solving Cryptography Problems - 4

Here is today’s first problem:

Let the public key be (y,p,g)=(64,101,2)(y, p, g) = (64, 101, 2). The El Gamal Digital Signature of 1111 is (r,s)=(8,s)(r, s) = (8, s), where s=s=?

  • What is the El Gamal Signature Scheme?
    wikipedia: The ElGamal signature scheme is a digital signature scheme which is based on the difficulty of computing discrete logarithms. It was described by Taher Elgamal in 1985.

    my notes:

    1. Public / Private Keys:
      A triple (y,p,g)(y, p, g), where pp is a prime number, gg is a generator for Zp∗\mathbb{Z}_{p}^{*} and y≡gx(modp)y \equiv g^x \pmod p where x is the private Key.

    2. Signing:
      The signature of a message mm is a pair (r,s)(r, s). Since this is a probabilistic signature scheme, in order to generate such a pair, the signer begins by choosing a random number kk such that 0≠k≠p−10 \ne k \ne p-1 and gcd⁡(k,p−1)=1\gcd (k, p-1) = 1. Then,

      r≡gk(modp)s≡(m−xr)⋅k−1(mod(p−1))\begin{aligned} r &\equiv g^{k} \pmod p \\ s &\equiv (m - xr)\cdot k^{-1} \pmod{(p-1)} \end{aligned}
    3. Verifying:
      Check that gm≡yrrs(modp)g^{m} \equiv y^{r} r^{s} \pmod p

    The equation for s in the Signing step was obtained as follows:

    gm≡yrrs(modp)gm≡gxrgks(modp)gm≡gxr+ks(modp)m≡xr+ks(mod(p−1))s≡(m−xr)k−1(mod(p−1))\begin{aligned} g^m &\equiv y^r r^s \pmod p \\ g^m &\equiv g^{xr} g^{ks} \pmod p \\ g^m &\equiv g^{xr + ks} \pmod p \\ m &\equiv xr + ks \pmod{(p-1)} \\ s &\equiv (m - xr) k^{-1} \pmod{(p-1)} \end{aligned}

    The second-to-last step might be confusing. Since gg is a generator of Zp∗\mathbb{Z}_p^* and pp is a prime number, we have that

    gz≡gz+(p−1)(modp)g^z \equiv g^{z + (p-1)} \pmod p

    for any z∈Zz \in \mathbb{Z}. In other words, the powers of gg are congruent modulo p−1p-1.

For this problem, we need to find ss. We already have the values of mm,rr and pp, which means we need the values of xx and kk. Those can be found easily by examining these equations:

64≡2x(mod101)8≡2k(mod101)\begin{aligned} 64 &\equiv 2^{x} \pmod{101} \\ 8 &\equiv 2^{k} \pmod{101} \end{aligned}

It is clear that x=6x=6 and k=3k=3. We can now find ss as,

s≡(11−6⋅8)⋅3−1≡−373≡633≡21(mod100)s \equiv (11 - 6 \cdot 8) \cdot 3^{-1} \equiv \frac{-37}{3} \equiv \frac{63}{3} \equiv 21 \pmod{100}

Therefore, s=21s=21 is the solution to this problem.

Let’s move on to the next one:

The Hadamard gate is applied to the two qubits of a 2-qubit system in state

12(∣00⟩+∣01⟩+∣10⟩+∣11⟩).\frac{1}{2} (|00 \rangle + |01 \rangle + |10 \rangle + |11 \rangle).

What is the resulting state of the 2-qubit system?

My notes, this youtube video and this stackexchange answer allowed me to understand how we can apply a Hadamard gate to two qubits.

First, we can rewrite the given state of the 2-qubit system as:

(∣0⟩+∣1⟩2)⊗(∣0⟩+∣1⟩2)\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)\otimes\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)

Now we will apply the Hadamard operation on each of these qubits,

H(∣0⟩+∣1⟩2)=(12[111−1])(12[11])=[10]H \left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right) = \left(\frac{1}{\sqrt{2}} \begin{bmatrix}1 & 1\\1 & -1\end{bmatrix}\right) \left(\frac{1}{\sqrt{2}}\begin{bmatrix}1\\1\end{bmatrix}\right) = \begin{bmatrix}1\\0\end{bmatrix}

And finally take the tensor product of the output from the operation,

[10]⊗[10]=[1000]\begin{bmatrix}1\\0\end{bmatrix} \otimes \begin{bmatrix}1\\0\end{bmatrix} = \begin{bmatrix}1\\0\\0\\0\end{bmatrix}

which is equivalent to ∣00⟩\lvert 00\rangle, the solution to this problem.

Even though I was able to solve this problem, I do not know anything about quantum computing. It seems like a very cool subject and I’d love to read and learn more about it. Until next time!