Bitcoin Forum
May 11, 2024, 11:38:00 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: multiply two points on curve.  (Read 109 times)
ecdsa123 (OP)
Full Member
***
Offline Offline

Activity: 211
Merit: 105

Dr WHO on disney+


View Profile
January 04, 2023, 08:50:28 PM
 #1



To multiply two points on an elliptic curve, you would use the elliptic curve point multiplication algorithm. This algorithm takes two points on the curve, P and P1, and a coefficient n, and returns a third point, nP1 + P.

To perform the multiplication, you would first choose a coefficient n and calculate the value of nP1. Then, you would add P to the result to get the final result, nP1 + P.

Here is an example of how you might implement this in code:

Code:
def multiply_points(P, P1, n):
  result = [0, 0]
  for i in range(n):
    result = add_points(result, P1)
  return add_points(result, P)

above function takes two points, P and P1, and a coefficient n, and returns the result of the multiplication nP1 + P. It does this by first initializing a result point to the identity element (0, 0) and then repeatedly adding P1 to the result point n times. Finally, it adds P to the result to get the final result.

Q: how can I faster do it?

One way to make the point multiplication algorithm faster is to use the double-and-add method. This method takes advantage of the fact that multiplying a point by a number n is the same as adding the point to itself n-1 times.

Here is an example of how you might implement the double-and-add method in code:

Code:

def multiply_points_fast(P, P1, n):
  result = [0, 0]
  while n > 0:
    if n % 2 == 1:
      result = add_points(result, P1)
    P1 = add_points(P1, P1)
    n = n // 2
  return result

Above function takes two points, P and P1, and a coefficient n, and returns the result of the multiplication nP1 + P. It does this by repeatedly doubling P1 and adding it to the result whenever the coefficient n is odd. By using this method, you can reduce the number of point additions required to calculate the result, making the overall calculation faster.
 
Q: what is n

In the context of elliptic curve point multiplication, n is a coefficient that determines how many times the point P1 should be added to itself. It is used to calculate the result of the multiplication nP1 + P.

For example, if n is 3 and P1 is (2, 3), then the result of the multiplication would be 3P1 + P = P1 + P1 + P1 + P. In this case, P1 would be added to itself 3 times to get the final result.

The value of n can be any integer, positive, negative, or zero. When n is positive, the result of the multiplication will be a point on the curve that is farther away from the identity element (0, 0). When n is negative, the result will be a point that is closer to the identity element. When n is zero, the result will be the identity element itself.
 

 

Another algorithm for multiplying two points on an elliptic curve is the sliding window method. This method works by breaking the coefficient n into "windows" of bits and precomputing a table of values that can be used to quickly compute the result of the multiplication.

Here is an example of how you might implement the sliding window method in code:

Code:
def multiply_points_sliding_window(P, P1, n, window_size):
  # Precompute a table of values
  table = [P1]
  for i in range(1, 1 << window_size):
    table.append(add_points(table[-1], P1))

  result = [0, 0]
  while n > 0:
    # Compute the next window of bits
    window = n & ((1 << window_size) - 1)
    for i in range(window_size - 1, -1, -1):
      if window & (1 << i) != 0:
        result = add_points(result, table[i])
    n = n >> window_size
    P1 = add_points(P1, P1)
  return result

This function takes two points, P and P1, and a coefficient n, as well as a window size, and returns the result of the multiplication nP1 + P. It does this by precomputing a table of values using the double-and-add method and then using the table to quickly compute the result by breaking the coefficient n into windows of bits. The size of the window can be adjusted to trade off space for time, depending on the desired performance.
 

Donate: bc1q0sezldfgm7rf2r78p5scasrrcfkpzxnrfcvdc6

Subscribe : http://www.youtube.com/@Ecdsa_Solutions
1715470680
Hero Member
*
Offline Offline

Posts: 1715470680

View Profile Personal Message (Offline)

Ignore
1715470680
Reply with quote  #2

1715470680
Report to moderator
1715470680
Hero Member
*
Offline Offline

Posts: 1715470680

View Profile Personal Message (Offline)

Ignore
1715470680
Reply with quote  #2

1715470680
Report to moderator
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715470680
Hero Member
*
Offline Offline

Posts: 1715470680

View Profile Personal Message (Offline)

Ignore
1715470680
Reply with quote  #2

1715470680
Report to moderator
ymgve2
Full Member
***
Offline Offline

Activity: 161
Merit: 230


View Profile
January 05, 2023, 05:05:16 AM
 #2

This isn't multiplying two points at all though, it is multiplying one point with a scalar, then adding another point to it.
yoshimitsu777
Newbie
*
Offline Offline

Activity: 72
Merit: 0


View Profile
January 07, 2023, 12:15:14 PM
 #3

ecdsa123 is not human but ai bot and posting into forum with crazy things not fitting to topic or without questions.
this bot tries to reply in context but often fails see here

https://bitcointalk.org/index.php?topic=5433136.msg61556811#msg61556811
https://bitcointalk.org/index.php?topic=5433027.msg61544585#msg61544585
https://bitcointalk.org/index.php?topic=5432839.msg61542178#msg61542178

ecdsa123 is same bot as Nt013 and some other names in forum
ecdsa123 (OP)
Full Member
***
Offline Offline

Activity: 211
Merit: 105

Dr WHO on disney+


View Profile
January 07, 2023, 12:27:32 PM
 #4

@yoshimitsu777

delete the post , you are doing "trash" inside topics.



yes, ymgve2 , we can call it in this way.
But if you can calculate the n properties in right way (n is not modulo curve order), you will be have according secp256k1 structure multiplicative real points.

difficult to explain , it can works when we in abstract way overflow of range curve order.

directly two points in carthesian way can't multiplicative.


Donate: bc1q0sezldfgm7rf2r78p5scasrrcfkpzxnrfcvdc6

Subscribe : http://www.youtube.com/@Ecdsa_Solutions
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!