Author

Topic: how to pow work with elliptic curve (Read 141 times)

copper member
Activity: 821
Merit: 1992
October 02, 2024, 01:35:11 AM
#9
Quote
I would like to know how to write in elliptic curve where g is a point?
ECDSA is not DSA. This is not how it works. You have DSA, and you want to convert it into ECDSA, but you won't, because in DSA, you have just some numbers, while in ECDSA, you have points.

Which means, that if you work only on private keys, then you can of course compute all things there. But: when you want to do the same thing on public keys, then you won't multiply two public keys alone. And also, you won't raise a given generator, to a given power, because exponentiation is just repeated multiplication.

My old topic about it: https://bitcointalksearch.org/topic/why-point-by-point-multiplication-is-undefined-in-ecdsa-5460766
legendary
Activity: 3472
Merit: 10611
October 02, 2024, 12:29:43 AM
#8
Is "pow" power? That's just modular exponentiation https://en.wikipedia.org/wiki/Modular_exponentiation and all "bigint" libs and ECC libraries should have a function that computes ModPow() for you. There are a couple of algorithms that can be used but I don't know what would be best for N-2 though...
legendary
Activity: 2254
Merit: 2003
A Bitcoiner chooses. A slave obeys.
October 01, 2024, 05:17:06 PM
#7
GPT is silly:)

I have readed a lot of sources.

in all exponential in ecdlp is rewriten as multiplicative in the group.

and I really do not know why.


Are you sure? It is supposed to be additive. DLP is multiplicative. I think your issue lies in notation (as mentioned, due to different mathematical structures).

g*g*g =/= 3g
jr. member
Activity: 51
Merit: 107
October 01, 2024, 04:52:22 PM
#6
GPT is silly:)

I have readed a lot of sources.

in all exponential in ecdlp is rewriten as multiplicative in the group.

and I really do not know why.
legendary
Activity: 2254
Merit: 2003
A Bitcoiner chooses. A slave obeys.
October 01, 2024, 04:45:36 PM
#5
scalar multiplication on elliptic curves and exponentiation modulo n are governed by different mathematical structures.

That is why you got two different results.

Ain't ChatGPT a beautiful thing?
jr. member
Activity: 51
Merit: 107
October 01, 2024, 04:35:57 PM
#4
I will explain:


let n -> order of the group - choosed as secp256k1

 n = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141


we have our generaror as G in secp256k1:

G.x = 55066263022277343669578718895168534326250603453777594175500187360389116729240
G.y = 32670510020758816978083085130507043184471273380659243275938904335757337482424


now when I do :
res = G * (n-2)

result  is  -2*G but with negate y.


now lets :
generator is 2 as DLP:

when I will do with the same order:
pow(2,n-2,n)

I got resultat 57896044618658097711785492504343953926418782139537452191302581570759080747169

which is half point of G of secp256k1

why not n-2?
legendary
Activity: 2254
Merit: 2003
A Bitcoiner chooses. A slave obeys.
October 01, 2024, 03:55:52 PM
#3


HI , it is maybe silly questions.

I have something like in pure python:

d = pow(g, f*(n-2) ,n)

where:  g - generator as integer
            f -  some int value
            n - order

I would like to know how to write in elliptic curve where g is a point?



You mean something like this?: https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication

COBRAS is right, it is easy to find out the answer on this one. Literally just inserted your question into ChatGPT:

Code:
from ecdsa import SECP256k1, ellipticcurve

# SECP256k1 curve
curve = SECP256k1.curve
G = SECP256k1.generator

# Parameters
f = 5  # some integer value
n = G.order()  # the order of the generator point

# Scalar multiplication on elliptic curve
scalar = f * (n - 2)

# Perform scalar multiplication with the generator point
D = scalar * G

# The result D is a point on the elliptic curve
print(f"Resulting point D: ({D.x()}, {D.y()})")

member
Activity: 873
Merit: 22
$$P2P BTC BRUTE.JOIN NOW ! https://uclck.me/SQPJk
jr. member
Activity: 51
Merit: 107
October 01, 2024, 02:20:54 PM
#1


HI , it is maybe silly questions.

I have something like in pure python:

d = pow(g, f*(n-2) ,n)

where:  g - generator as integer
            f -  some int value
            n - order

I would like to know how to write in elliptic curve where g is a point?

Jump to: