Reputation: 135
I have been trying to find the affine coordinates from given jacobian coordinates using maple but I am unable to execute the divide and mod function properly. Below is the code.
> x := convert("9BAE2D5BAC61E6EA5DE635BCA754B2564B7D78C45277CAD67E45C4CBBEA6E706", decimal, hex);
7041623596977247007669265857371148522199703362600663731937152060\
0331187054342
> y := convert("34FB8147EED1C0FBE29EAD4D6C472EB4EF7B2191FDE09E494B2A9845FE3F605E", decimal, hex);
print(`output redirected...`); # input placeholder
23964639004174789156012647374812775627552779006284114197031881030909921550430
> P = convert("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", decimal, hex);
P = 115792089237316195423570985008687907853269984665640564039457584007908834671663
> z := convert("C327B5D2636B32F27B051E4742B1BBD5324432C1000BFEDCA4368A29F6654152", decimal, hex);
88271167397410887906404620526072296461301967675745183033087652951303987216722
> pxaffine := x/z^2 mod p;
modp(35208117984886235038346329286855742610998516813003318659685\
760300165593527171/3895899496850867432972229541307004669958561\
04445384115473225358287940086633208436094051269966956339075604\
3250895513211480436277854984163960587194098212642, p) // this is returned as a result while i expect a whole number value
xa := convert(pxaffine,hex);
//below is the error found Error, invalid input: convert/hex expects its 1st argument, n, to be of type nonnegint, but received modp(35208117984886235038346329286855742610998516813003318659685760300165593527171/3895899496850867432972229541307004669958561044453841154732253582879400866332084360940512699669563390756043250895513211480436277854984163960587194098212642, p)
Definitely, I will get this error because value in pxaffine is not valid,,, now my question is why this command "pxaffine := x/z^2 mod p;" doesnot work?
Upvotes: 0
Views: 196
Reputation: 7271
The lowercase name p
is not being assigned a value anywhere in your code, so the following command does not produce an integer result (ie. it returns unevaluated),
x/z^2 mod p;
The following line of your code does not assign an integer to lowercase p
. It doesn't even assign to uppercase P
because it uses =
rather than :=
.
P = convert("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", decimal, hex);
Perhaps you intended it to be an actual assignment to lowercase p
, ie,
p := convert("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", decimal, hex);
So now let's try the example, excluding the assignment to y
which is not used anywhere else. Here's what I get (output is indented):
x := convert("9BAE2D5BAC61E6EA5DE635BCA754B2564B7D78C45277CAD67E45C4CBBEA6E706", decimal, hex);
x := 70416235969772470076692658573711485221997033626006637319371520600331187054342
p := convert("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", decimal, hex);
p := 115792089237316195423570985008687907853269984665640564039457584007908834671663
z := convert("C327B5D2636B32F27B051E4742B1BBD5324432C1000BFEDCA4368A29F6654152", decimal, hex);
z := 88271167397410887906404620526072296461301967675745183033087652951303987216722
pxaffine := x/z^2 mod p;
pxaffine := 103388573995635080359749164254216598308788835304023601477803095234286494993683
xa := convert(pxaffine,hex);
xa := E493DBF1C10D80F3581E4904930B1404CC6C13900EE0758474FA94ABE8C4CD13
Upvotes: 2