Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: COBRAS on April 09, 2022, 04:06:07 AM



Title: how to find find % of publick key ?
Post by: COBRAS on April 09, 2022, 04:06:07 AM
Publick key - 035091541F5851647A93DF0C14152A4516169B5BD6ACF793DEE8C9DFA27710E4B0


how to find 035091541F5851647A93DF0C14152A4516169B5BD6ACF793DEE8C9DFA27710E4B0 % 7890161 ?

% - modulo

Br


Title: Re: how to find find % of publick key ?
Post by: pooya87 on April 09, 2022, 04:10:35 AM
The modulo operation makes no sense here.
You can multiply a point on an elliptic curve by a number and by extension you can divide it by a number but a point (that is x and y coordinates) doesn't have a remainder!


Title: Re: how to find find % of publick key ?
Post by: COBRAS on April 09, 2022, 04:23:26 AM
The modulo operation makes no sense here.
You can multiply a point on an elliptic curve by a number and by extension you can divide it by a number but a point (that is x and y coordinates) doesn't have a remainder!

but privkey has... so,  pubkey has  too


Title: Re: how to find find % of publick key ?
Post by: CoinMagus on April 09, 2022, 09:45:45 AM
even if it were possible, it would be indistinguishable from the partition, i.e. the private key would be out of range.


Title: Re: how to find find % of publick key ?
Post by: garlonicon on April 09, 2022, 05:49:32 PM
Quote
but privkey has... so,  pubkey has  too
Not at all. I told you: the private key is the relation between the base point and your point, so "basePoint*privKey=yourPoint". Your public key does not have a remainder, because the private key exists only for a given base point, for a different point it will have completely different value. So, you can have a "remainder" only for a pair of points, like (basePoint;yourPoint), but not for a single point.


Title: Re: how to find find % of publick key ?
Post by: COBRAS on April 09, 2022, 07:15:12 PM
Quote
but privkey has... so,  pubkey has  too
Not at all. I told you: the private key is the relation between the base point and your point, so "basePoint*privKey=yourPoint". Your public key does not have a remainder, because the private key exists only for a given base point, for a different point it will have completely different value. So, you can have a "remainder" only for a pair of points, like (basePoint;yourPoint), but not for a single point.

What you talk abour ?

1026 MOD 64 is : 2

minus mod - 2

1024 MOD 64 is : 0 so, if you substrack 2 from pubkey you down you range fro 1:1024 to 1: 16 !!!

2 is remainder !! not base point

but no funtion for publick key !

how to find


Title: Re: how to find find % of publick key ?
Post by: COBRAS on April 10, 2022, 01:46:45 AM
Quote
but privkey has... so,  pubkey has  too
Not at all. I told you: the private key is the relation between the base point and your point, so "basePoint*privKey=yourPoint". Your public key does not have a remainder, because the private key exists only for a given base point, for a different point it will have completely different value. So, you can have a "remainder" only for a pair of points, like (basePoint;yourPoint), but not for a single point.

What you talk abour ?

1026 MOD 64 is : 2

minus mod - 2

1024 MOD 64 is : 0 so, if you substrack 2 from pubkey you down you range fro 1:1024 to 1: 16 !!!

2 is remainder !! not base point

but no funtion for publick key !

how to find

noone has idea how to calculate  mod of pubkey ?


Title: Re: how to find find % of publick key ?
Post by: litecoin_messiah on April 10, 2022, 07:47:54 AM
Quote
but privkey has... so,  pubkey has  too
Not at all. I told you: the private key is the relation between the base point and your point, so "basePoint*privKey=yourPoint". Your public key does not have a remainder, because the private key exists only for a given base point, for a different point it will have completely different value. So, you can have a "remainder" only for a pair of points, like (basePoint;yourPoint), but not for a single point.

What you talk abour ?

1026 MOD 64 is : 2

minus mod - 2

1024 MOD 64 is : 0 so, if you substrack 2 from pubkey you down you range fro 1:1024 to 1: 16 !!!

2 is remainder !! not base point

but no funtion for publick key !

how to find

noone has idea how to calculate  mod of pubkey ?

i don't have time but play around with pycoin

Quote
ku 035091541F5851647A93DF0C14152A4516169B5BD6ACF793DEE8C9DFA27710E4B0 --json
{
   "BTC_address": "12bahMGWAnSEYS3PKURvhScm8GmZhejY7t",
   "BTC_address_segwit": "bc1qzxpx2mkf25ungac3yfkm9k7nfde3ympzxk6sqj",
   "BTC_address_uncompressed": "16PvA358rPPhyirFyko9zRptKWL69EinoN",
   "address": "12bahMGWAnSEYS3PKURvhScm8GmZhejY7t",
   "address_segwit": "bc1qzxpx2mkf25ungac3yfkm9k7nfde3ympzxk6sqj",
   "address_uncompressed": "16PvA358rPPhyirFyko9zRptKWL69EinoN",
   "hash160": "1182656ec95539347711226db2dbd34b73126c22",
   "hash160_uncompressed": "3b2e26fcd8888c57d99652937ac9e975e9f64dd7",
   "input": "035091541F5851647A93DF0C14152A4516169B5BD6ACF793DEE8C9DFA27710E4B0",
   "key_pair_as_sec": "035091541f5851647a93df0c14152a4516169b5bd6acf793dee8c9dfa27710e4b0",
   "key_pair_as_sec_uncompressed": "045091541f5851647a93df0c14152a4516169b5bd6acf793dee8c9dfa27710e4b0ec29eeaf3d880 023f13d2608200ec283c971081ee88ec05247bf6d65b57e8537",
   "network": "Bitcoin mainnet",
   "p2sh_segwit": "3EZXJeaZVsF1eFFXyLGHZ6CBn1ctwC9fHx",
   "p2sh_segwit_script": "00141182656ec95539347711226db2dbd34b73126c22",
   "public_pair_x": "36441801302806618484038906762766908306697395008217419414017649305421238822064",
   "public_pair_x_hex": "5091541f5851647a93df0c14152a4516169b5bd6acf793dee8c9dfa27710e4b0",
   "public_pair_y": "106819920335407981491505420347768958799539175113579525933191638145241450448183",
   "public_pair_y_hex": "ec29eeaf3d880023f13d2608200ec283c971081ee88ec05247bf6d65b57e8537",
   "symbol": "BTC",
   "y_parity": "odd"
}

https://pycoin.readthedocs.io/en/latest/search.html?q=modulo&check_keywords=yes&area=default

bit https://bit.dev/ is also good

btw not sure if this helps but i ust got the x value (lttle endian) as int and did

 
Quote
ku 36441801302806618484038906762766908306697395008217419414017649305421238822064/odd

Code:
input                        : 364418013028066184840389067627669083066973950082174194140176493054\
                                 21238822064/odd
network                      : Bitcoin mainnet
symbol                       : BTC
public pair x                : 36441801302806618484038906762766908306697395008217419414017649305421238822064
public pair y                : 106819920335407981491505420347768958799539175113579525933191638145241450448183
 x as hex                    : 5091541f5851647a93df0c14152a4516169b5bd6acf793dee8c9dfa27710e4b0
 y as hex                    : ec29eeaf3d880023f13d2608200ec283c971081ee88ec05247bf6d65b57e8537
y parity                     : odd
key pair as sec              : 035091541f5851647a93df0c14152a4516169b5bd6acf793dee8c9dfa27710e4b0
 uncompressed                : 045091541f5851647a93df0c14152a4516169b5bd6acf793dee8c9dfa27710e4b0\
                                 ec29eeaf3d880023f13d2608200ec283c971081ee88ec05247bf6d65b57e8537
hash160                      : 1182656ec95539347711226db2dbd34b73126c22
 uncompressed                : 3b2e26fcd8888c57d99652937ac9e975e9f64dd7
Bitcoin address              : 12bahMGWAnSEYS3PKURvhScm8GmZhejY7t
Bitcoin address uncompressed : 16PvA358rPPhyirFyko9zRptKWL69EinoN
Bitcoin segwit address       : bc1qzxpx2mkf25ungac3yfkm9k7nfde3ympzxk6sqj
p2sh segwit                  : 3EZXJeaZVsF1eFFXyLGHZ6CBn1ctwC9fHx
 corresponding p2sh script   : 00141182656ec95539347711226db2dbd34b73126c22

it gave that


Title: Re: how to find find % of publick key ?
Post by: alexeyneu on April 12, 2022, 12:27:15 PM
it's np to do.
use
BN_hex2bn() and BN_nnmod() from <openssl/bn.h>  (openssl's libcrypto)

https://github.com/alexeyneu/BlockZero/blob/29ed505a211d14d4577012438cd8bec9d15f1272/connection/x.cpp#L287-L329
nnmod() hasn't been used there but it's straight thing to do.