Ok, now the second issue is that I need to have
0x02,
0x03 and/or
0x04 instead of just
0x2,
0x3 and/or
0x4. So, I'm missing a
0 while printing. I tried a few ways playing with the specifiers and with and etc from GMP ocs but I couldn't achieve the result I wanted!
So, for instance, if I ave a pub key like:
PubKey ==> Q.x = 0x100016a48cf2dde9b42c4cf866a3824a191d914c160a8c93642ffabdd50ffe53
PubKey ==> Q.y = 0x756cca6deca622301992d5070c1e5112fbc43ad7e44cfe8a8499a0006a52e1d3
I test if
Q.y is odd or even and according to the result, I need to prepend
02 if it is even, and
03 if it is odd and later I'll add yet another situation, but for now, this is what I need to do. The part of checking if
Q.y is odd or even it's done, the part of adding the
2 or the
3 is also done, but now I need to include the
02 instead of
2 and te
03 instead of
3. This is only for printing, so the solution is in the gmp_printf() function.
Edited;
Ok, I got it. Later I'll say what is the other sitaution I need to add!
I got it like:
Code: Select all
gmp_printf("Compressed Public Key: %#.66Zx\n", compressed_pubKey);