I am trying to implement the Fiat-Shamir identification protocol, however the end results always fail to match. I am using algorithm's description from here.
Preparation:
Select 2 prime integers and their product:
n = 19 * 23 = 437
Select
s
coprime ton
:s = 242
Compute
v
:v = (s^2) % n = 6
Now the round:
Select random
r
between1
andn - 1
:r = 410
Calculate
x
:x = (r^2) % n = 292
Choose
e
either 0 or 1:e = 1
Calculate
y
:y = (r * s^e) % n = 21
Now if y^2
equals (x * v^e) % n
then it's accepted. However in my case
y^2 = 441
(x * v^e) % n = 4
Why don't these numbers match? What am I doing wrong here?
y^2
equals(x * v^e) % n
" should be "$y^2\equiv x\cdot v^e\pmod n$", written here as$y^2\equiv x\cdot v^e\pmod n$
, which does hold. That's because441 - 4
is a multiple of437
, or/and because441 % 437 == 4
$\endgroup$x * (v^e % n)
? It equals1752
. $\endgroup$