Is multiplying the same public key possible?

4 replies 497 views
kevinatlasFull Member
Posts: 25 · Reputation: 253
#1Nov 23, 2017, 12:53 AM
Been digging into Bitcoin and have a question. If you multiply a public key by a private key, you get another public key, right? But what happens if you multiply the same public key by itself? Is that even a thing? Here's some code I've been working with: from ecdsa import SECP256k1, VerifyingKey from ecdsa.ellipticcurve import Point def public_key_to_scalar(public_key) -> int: # Converts a public key to an integer scalar. return int.from_bytes(public_key.to_string(), 'big') def multiply_public_key_by_scalar(pub_key, scalar) -> Point: # Multiplies a public key by a scalar. return pub_key.pubkey.point * scalar def point_to_hex(point) -> str: # Converts an elliptic curve point to a hexadecimal string in 0x format. x_hex = "0x" + format(point.x(), '064x') y_hex = "0x" + format(point.y(), '064x') return x_hex, y_hex # Input public key as a hexadecimal string input_hex1 = "b84a76136d0c86725a8a305f4a87aeeaa9f44eead621dd1e84d0ea1ad85d82ab" + "9deccad50c1d1b9575d2fd2223215b5d74e29a87cd7879e343296eb688206713" # Convert to VerifyingKey object pub_key1 = VerifyingKey.from_string(bytes.fromhex(input_hex1), curve=SECP256k1) # Define a scalar (could be a private key or large random integer) scalar = 0x2 # Example scalar value # Multiply the public key by the scalar result_point = multiply_public_key_by_scalar(pub_key1, scalar) # Convert the result to a hexadecimal string
6 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#2Nov 23, 2017, 03:39 AM
In Elliptic Curve Cryptography you can't multiply two points. The only thing that is defined is multiplication of a point with a number which is defined as adding that point to itself number times. If you are converting that other point to a scalar (public_key_to_scalar) with a workaround, then you are already doing what I said not what you asked in your title.
4 Reply Quote Share
sage777Full Member
Posts: 102 · Reputation: 305
#3Nov 23, 2017, 09:18 AM
Why point by point multiplication is undefined in ECDSA?
4 Reply Quote Share
sam.bullSenior Member
Posts: 390 · Reputation: 1323
#4Nov 23, 2017, 05:05 PM
Converting from Pubkey to scalar is not really valid in the elliptic curve. You can only multiply by a scalar or add the Pubkeys For example
3 Reply Quote Share
fox100Senior Member
Posts: 165 · Reputation: 1050
#5Nov 23, 2017, 11:22 PM
It's less that it's not defined it's that there is no known efficient algorithm for it.  If you had an efficient algorithm for the DLP in the group you could give point point multiplication answers.  If you could compute the product of points directly you could solve the decisional DH problem, which is believed to be hard in groups like secp256k1.
2 Reply Quote Share

Related topics