Curve 25519 (X25519, Ed25519) Convert coordinates between Montgomery curve and twisted Edwards curve
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have some misunderstanding about EdDSA conversion coordinates between Montgomery curve and twisted Edwards curve. In https://tools.ietf.org/html/rfc7748 I see that a base point for Curve25519 is
Montgomery curve:
U(P) 9
V(P) 14781619447589544791020593568409986887264606134616475288964881837755586237401
Twisted Edwards curve:
X(P) 15112221349535400772501151409588531511454012693041857206046113283949847762202
Y(P) 46316835694926478169428394003475163141307993866256225615783033603165251855960
and then I see
The birational maps are:
$(u, v) = frac1+y1-y, sqrt-486664*fracux$
$(x, y) = sqrt-486664*fracuv, fracu-1u+1$
But if we try convert $(x,y)$ to $(u,v)$ or $(u,v)$ to $(x,y)$ by using these formulas, we will not get correct answers. For example convert y-coordinate to u-coordinate:
(1+46316835694926478169428394003475163141307993866256225615783033603165251855960)/(1-46316835694926478169428394003475163141307993866256225615783033603165251855960)
result will not be equal to
14781619447589544791020593568409986887264606134616475288964881837755586237401
How can I convert coordinates between Montgomery curve and twisted Edwards curve correctly?
elliptic-curves signature ed25519 x25519
add a comment |Â
up vote
2
down vote
favorite
I have some misunderstanding about EdDSA conversion coordinates between Montgomery curve and twisted Edwards curve. In https://tools.ietf.org/html/rfc7748 I see that a base point for Curve25519 is
Montgomery curve:
U(P) 9
V(P) 14781619447589544791020593568409986887264606134616475288964881837755586237401
Twisted Edwards curve:
X(P) 15112221349535400772501151409588531511454012693041857206046113283949847762202
Y(P) 46316835694926478169428394003475163141307993866256225615783033603165251855960
and then I see
The birational maps are:
$(u, v) = frac1+y1-y, sqrt-486664*fracux$
$(x, y) = sqrt-486664*fracuv, fracu-1u+1$
But if we try convert $(x,y)$ to $(u,v)$ or $(u,v)$ to $(x,y)$ by using these formulas, we will not get correct answers. For example convert y-coordinate to u-coordinate:
(1+46316835694926478169428394003475163141307993866256225615783033603165251855960)/(1-46316835694926478169428394003475163141307993866256225615783033603165251855960)
result will not be equal to
14781619447589544791020593568409986887264606134616475288964881837755586237401
How can I convert coordinates between Montgomery curve and twisted Edwards curve correctly?
elliptic-curves signature ed25519 x25519
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have some misunderstanding about EdDSA conversion coordinates between Montgomery curve and twisted Edwards curve. In https://tools.ietf.org/html/rfc7748 I see that a base point for Curve25519 is
Montgomery curve:
U(P) 9
V(P) 14781619447589544791020593568409986887264606134616475288964881837755586237401
Twisted Edwards curve:
X(P) 15112221349535400772501151409588531511454012693041857206046113283949847762202
Y(P) 46316835694926478169428394003475163141307993866256225615783033603165251855960
and then I see
The birational maps are:
$(u, v) = frac1+y1-y, sqrt-486664*fracux$
$(x, y) = sqrt-486664*fracuv, fracu-1u+1$
But if we try convert $(x,y)$ to $(u,v)$ or $(u,v)$ to $(x,y)$ by using these formulas, we will not get correct answers. For example convert y-coordinate to u-coordinate:
(1+46316835694926478169428394003475163141307993866256225615783033603165251855960)/(1-46316835694926478169428394003475163141307993866256225615783033603165251855960)
result will not be equal to
14781619447589544791020593568409986887264606134616475288964881837755586237401
How can I convert coordinates between Montgomery curve and twisted Edwards curve correctly?
elliptic-curves signature ed25519 x25519
I have some misunderstanding about EdDSA conversion coordinates between Montgomery curve and twisted Edwards curve. In https://tools.ietf.org/html/rfc7748 I see that a base point for Curve25519 is
Montgomery curve:
U(P) 9
V(P) 14781619447589544791020593568409986887264606134616475288964881837755586237401
Twisted Edwards curve:
X(P) 15112221349535400772501151409588531511454012693041857206046113283949847762202
Y(P) 46316835694926478169428394003475163141307993866256225615783033603165251855960
and then I see
The birational maps are:
$(u, v) = frac1+y1-y, sqrt-486664*fracux$
$(x, y) = sqrt-486664*fracuv, fracu-1u+1$
But if we try convert $(x,y)$ to $(u,v)$ or $(u,v)$ to $(x,y)$ by using these formulas, we will not get correct answers. For example convert y-coordinate to u-coordinate:
(1+46316835694926478169428394003475163141307993866256225615783033603165251855960)/(1-46316835694926478169428394003475163141307993866256225615783033603165251855960)
result will not be equal to
14781619447589544791020593568409986887264606134616475288964881837755586237401
How can I convert coordinates between Montgomery curve and twisted Edwards curve correctly?
elliptic-curves signature ed25519 x25519
elliptic-curves signature ed25519 x25519
edited 2 hours ago
Ruggero
3,9991427
3,9991427
asked 4 hours ago
sribin
1057
1057
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
The formulas actually work.
You just have to keep in mind to make computation in the field of intergers modulo $2^255-19$ and that there are actually two square roots, you need to use the right one if you want to have the expected result.
You can test the following SAGE code
gf=GF(2^255-19)
X_P = gf(15112221349535400772501151409588531511454012693041857206046113283949847762202)
Y_P = gf(46316835694926478169428394003475163141307993866256225615783033603165251855960)
u = (1+Y_P)/(1-Y_P)
v = gf(-486664).sqrt()*u/X_P,-(gf(-486664).sqrt())*u/X_P
print u
print v
on the Sage Cell server.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
The formulas actually work.
You just have to keep in mind to make computation in the field of intergers modulo $2^255-19$ and that there are actually two square roots, you need to use the right one if you want to have the expected result.
You can test the following SAGE code
gf=GF(2^255-19)
X_P = gf(15112221349535400772501151409588531511454012693041857206046113283949847762202)
Y_P = gf(46316835694926478169428394003475163141307993866256225615783033603165251855960)
u = (1+Y_P)/(1-Y_P)
v = gf(-486664).sqrt()*u/X_P,-(gf(-486664).sqrt())*u/X_P
print u
print v
on the Sage Cell server.
add a comment |Â
up vote
3
down vote
accepted
The formulas actually work.
You just have to keep in mind to make computation in the field of intergers modulo $2^255-19$ and that there are actually two square roots, you need to use the right one if you want to have the expected result.
You can test the following SAGE code
gf=GF(2^255-19)
X_P = gf(15112221349535400772501151409588531511454012693041857206046113283949847762202)
Y_P = gf(46316835694926478169428394003475163141307993866256225615783033603165251855960)
u = (1+Y_P)/(1-Y_P)
v = gf(-486664).sqrt()*u/X_P,-(gf(-486664).sqrt())*u/X_P
print u
print v
on the Sage Cell server.
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
The formulas actually work.
You just have to keep in mind to make computation in the field of intergers modulo $2^255-19$ and that there are actually two square roots, you need to use the right one if you want to have the expected result.
You can test the following SAGE code
gf=GF(2^255-19)
X_P = gf(15112221349535400772501151409588531511454012693041857206046113283949847762202)
Y_P = gf(46316835694926478169428394003475163141307993866256225615783033603165251855960)
u = (1+Y_P)/(1-Y_P)
v = gf(-486664).sqrt()*u/X_P,-(gf(-486664).sqrt())*u/X_P
print u
print v
on the Sage Cell server.
The formulas actually work.
You just have to keep in mind to make computation in the field of intergers modulo $2^255-19$ and that there are actually two square roots, you need to use the right one if you want to have the expected result.
You can test the following SAGE code
gf=GF(2^255-19)
X_P = gf(15112221349535400772501151409588531511454012693041857206046113283949847762202)
Y_P = gf(46316835694926478169428394003475163141307993866256225615783033603165251855960)
u = (1+Y_P)/(1-Y_P)
v = gf(-486664).sqrt()*u/X_P,-(gf(-486664).sqrt())*u/X_P
print u
print v
on the Sage Cell server.
answered 2 hours ago
Ruggero
3,9991427
3,9991427
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f63732%2fcurve-25519-x25519-ed25519-convert-coordinates-between-montgomery-curve-and-t%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password