In X25519, I would like to multiply a point P by scalar s, using the scalarMultiply() function. Then, I would like to multiply the resulting point by the scalar s_inverse, in order to recover the original point. However, that is not working for me, I'm not getting back the original point.
I'm computing the inverse in the modular field Z_{8q} where q equals 2^252 + 27742317777372353535851937790883648493.
Attached is the full code illustrating the problem. To run it, change the extension to .html. Also download the BigInteger.js and nacl.js dependencies from the URLs listed, and place it in the same folder.
In X25519, I would like to multiply a point P by scalar s, using the scalarMultiply() function. Then, I would like to multiply the resulting point by the scalar s_inverse, in order to recover the original point. However, that is not working for me, I'm not getting back the original point.
I'm computing the inverse in the modular field Z_{8q} where q equals 2^252 + 27742317777372353535851937790883648493.
Attached is the full code illustrating the problem. To run it, change the extension to .html. Also download the BigInteger.js and nacl.js dependencies from the URLs listed, and place it in the same folder.
test_inverse.html.txt