Author

Topic: multiply two points on curve. (Read 109 times)

full member
Activity: 211
Merit: 105
Dr WHO on disney+
January 07, 2023, 08:27:32 AM
#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.

newbie
Activity: 72
Merit: 0
January 07, 2023, 08:15:14 AM
#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://bitcointalksearch.org/topic/iceland-secp256k1-import-in-python-5433136
https://bitcointalksearch.org/topic/m.61544585
https://bitcointalksearch.org/topic/m.61542178

ecdsa123 is same bot as Nt013 and some other names in forum
full member
Activity: 161
Merit: 230
January 05, 2023, 01: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.
full member
Activity: 211
Merit: 105
Dr WHO on disney+
January 04, 2023, 04: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.
 
Jump to: