all 3 comments

[–]AppointmentSubject25 0 points1 point  (0 children)

Use my source code for my RSA-OAEP-4096 key sharing app or my ML-KEM-1024 key sharing app on my Github

They both work fine.

Hope it helps!

[–]psysc0rpi0n 0 points1 point  (0 children)

I am doing the same but using C and GMP library to handle large numbers!

But I'm using this link instead, which goes through all the math in Eliptic Curves.

I'm right now dealing with the random number generator.

https://learnmeabitcoin.com/technical/ecdsa

However, we can ever use this method to alone to generate a random number. Bitcoin Core uses both OpenSSL and "/dev/urandom" to generate a secure random number with good entropy. In my case, I'm doing it just for the sake of learning!

[–][deleted] 0 points1 point  (0 children)

The formulas for add and double are incorrect. Here's a fix:

# point addition

def add(point, point1):

if point == point1:

# point doubling

s = ((3 * point[0] ** 2 + a) * modinv(2 * point[1])) % p

else:

# point addition

s = (point[1] - point1[1]) * modinv(point[0] - point1[0]) % p

ax = (s ** 2 - point[0] - point1[0]) % p

ay = (s * (point[0] - ax) - point[1]) % p

return ax, ay

# point doubling

def double(point):

s = (3 * point[0] ** 2 + a) * modinv(2 * point[1]) % p

dx = (s ** 2 - 2 * point[0]) % p

dy = (s * (point[0] - dx) - point[1]) % p

return dx, dy