Quantcast
Viewing all articles
Browse latest Browse all 3567

Programming • GMP library usage questions

I was able to fix the problem in the meantime and I moved on.
I have now a working code and I'm now trying to find a way to solve the next problem.

The current code can be found here, if there is any interest in taking a look at it:
https://gitlab.com/PsySc0rpi0n/bitcoinexp

Now, I need a way of prepending either "02", "03" or "04" to the resulting point I get with the current code.
The current code results in printing the coordinates of a point, and I'm printing them in hexadecimal format!

So, for instance, if the output of my program is:
PrivKey = 0x6af48b6e46838aa874fb6a20143283915b97b28fd5c0a44da4b669ac7c54bff2PubKey Q[x, y] = privKey * [G.x, G.y]PubKey ==> Q.x = 0xd970da2247dbc397c915321f8b7e7ab56d7f15b51baa9931d7767657abf039a2PubKey ==> Q.y = 0xcc2fa9a21349afaa84d57d55a581380380202249e80a6b442499ec1e924f8e98
The new problem is that I need to prepend "02", "03" or "04" to the Q.x coordinate depending on 3 different scenarios, Checking the 3 different scenarios should not be difficult. The problem is prepending any of those 3 possibilities to the Q.x value so that I obtain either (ignoring the 0x for now):
02d970da2247dbc397c915321f8b7e7ab56d7f15b51baa9931d7767657abf039a2
or
03d970da2247dbc397c915321f8b7e7ab56d7f15b51baa9931d7767657abf039a2
or
04d970da2247dbc397c915321f8b7e7ab56d7f15b51baa9931d7767657abf039a2cc2fa9a21349afaa84d57d55a581380380202249e80a6b442499ec1e924f8e98
Yes the last case, the "04", I also need to append the Q.y to Q.x.

I've been trying to use
mpz_export()
but yet without success!

Statistics: Posted by PsySc0rpi0n — 2024-01-04 22:37 — Replies 14 — Views 11553



Viewing all articles
Browse latest Browse all 3567

Trending Articles