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 = 437Select
scoprime ton:s = 242Compute
v:v = (s^2) % n = 6
Now the round:
Select random
rbetween1andn - 1:r = 410Calculate
x:x = (r^2) % n = 292Choose
eeither 0 or 1:e = 1Calculate
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^2equals(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 - 4is a multiple of437, or/and because441 % 437 == 4– fgrieu Feb 16 '14 at 17:49x * (v^e % n)? It equals1752. – Babken Vardanyan Feb 16 '14 at 17:56