Show Posts
|
Pages: [1]
|
Basically unravel the nesting so that one has distinct functions. Like the Public X = ( long normal math function ) Mod P, then the same for Public Y. It looks like this is possible. No one has laid this out this way so it can be explained in layman's terms.
|
|
|
From the last post private to public question. Having gone over the web pages that talk about elliptic math, there is still an implementation question. The only place I have found this is in the pybitcointools. I emailed the author with no reply. Below is the code. You will notice the INV function. This is interesting as it replaces a divide. I have not seen this done before.
Can anyone decode this to a simple math function. Because of the INV high/low and private key odd/even it looks like the system falls into four states of functionality. Not knowing python enough to unravel the nested functions it is a rosetta problem for me. Some thing like Public X = ( long normal function ) * Private key Mod P or the like. It looks like with the two tests will wind up with four possible normal functions. In base ten would be good as then all of the conversions are set aside.
P = 2**256-2**32-2**9-2**8-2**7-2**6-2**4-1 N = 115792089237316195423570985008687907852837564279074904382605163141518161494337 A = 0 Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240 Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424 G = (Gx,Gy)
def inv(a,n): lm, hm = 1,0 low, high = a%n,n while low > 1: r = high/low nm, new = hm-lm*r, high-low*r lm, low, hm, high = nm, new, lm, low return lm % n
### Elliptic Curve functions
def isinf(p): return p[0] == 0 and p[1] == 0
def base10_add(a,b): if isinf(a): return b[0],b[1] if isinf(b): return a[0],a[1] if a[0] == b[0]: if a[1] == b[1]: return base10_double(a[0],a[1]) else: return (0,0) m = ((b[1]-a[1]) * inv(b[0]-a[0],P)) % P x = (m*m-a[0]-b[0]) % P y = (m*(a[0]-x)-a[1]) % P return (x,y) def base10_double(a): if isinf(a): return (0,0) m = ((3*a[0]*a[0]+A)*inv(2*a[1],P)) % P x = (m*m-2*a[0]) % P y = (m*(a[0]-x)-a[1]) % P return (x,y)
def base10_multiply(a,n): if isinf(a) or n == 0: return (0,0) if n == 1: return a if n < 0 or n >= N: return base10_multiply(a,n%N) if (n%2) == 0: return base10_double(base10_multiply(a,n/2)) if (n%2) == 1: return base10_add(base10_double(base10_multiply(a,n/2)),a)
def privkey_to_pubkey(privkey): if isinstance(privkey,(int,long)): return base10_multiply(G,privkey) if len(privkey) == 64: return point_to_hex(base10_multiply(G,decode(privkey,16))) elif len(privkey) == 66: return compress(base10_multiply(G,decode(privkey[:-2],16)),'hex') elif len(privkey) == 32: return point_to_hex(base10_multiply(G,decode(privkey,16))) elif len(privkey) == 33: return compress(base10_multiply(G,decode(privkey[:-1],16)),'bin') else: return privkey_to_pubkey(b58check_to_hex(privkey))
privtopub = privkey_to_pubkey
|
|
|
I started by looking at openssl. I cannot find where this is done in C in their area. The executable puts out a pem file that looks like this:
Private-Key: (256 bit) priv: 00:f8:ed:69:2e:36:41:73:c9:17:bf:c6:16:ce:cd: 6a:af:49:11:1e:a8:d2:00:47:6f:c2:25:62:85:50: 80:9b:a0 pub: 04:9e:54:ce:31:52:2d:fc:18:a4:7a:f6:2e:b4:34: f8:70:69:e6:d9:2c:ac:1f:7c:d2:8f:98:ac:0c:ac: 7f:69:ec:06:bf:e6:d5:b4:cd:af:4e:8c:2f:a5:59: 63:d0:38:56:e6:17:fb:38:2e:e4:e3:75:ee:ca:5b: e3:0c:44:03:3d ASN1 OID: secp256k1 -----BEGIN PUBLIC KEY----- MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEnlTOMVIt/BikevYutDT4cGnm2SysH3zS j5isDKx/aewGv+bVtM2vTowvpVlj0DhW5hf7OC7k43XuylvjDEQDPQ== -----END PUBLIC KEY-----
Being that it is a loop I am sure it is not doing the double then add. That would take too long I think. There is just no real documentation on the different libraries on how this is done in layman's terms. Great on the x only with two possible y values. Is there any way of getting a break down in English as a step by step on the whole process. I have been looking every where and have found a number of books on all of this and it simply does not exist.
|
|
|
Great. The point math and log factoring is unto itself. I am good with this. I am sure when the code simply calculates from a private key to a public point. it is not doing the complete factoring work. I was only seeing if there are some python people out there that can explain the code so that as this should work one can read it. Basically putting what the main function is doing in normal math rather than learning python complete. I am sure that this can be done as someone has compatible code that works with the blockchain relative to open ssl.
|
|
|
I found this python code from pybitcoin tools. In the main:
def base10_multiply(a,n): if isinf(a) or n == 0: return (0,0) if n == 1: return a if n < 0 or n >= N: return base10_multiply(a,n%N) if (n%2) == 0: return base10_double(base10_multiply(a,n/2)) if (n%2) == 1: return base10_add(base10_double(base10_multiply(a,n/2)),a)
def privkey_to_pubkey(privkey): if isinstance(privkey,(int,long)): return base10_multiply(G,privkey) if len(privkey) == 64: return point_to_hex(base10_multiply(G,decode(privkey,16))) elif len(privkey) == 66: return compress(base10_multiply(G,decode(privkey[:-2],16)),'hex') elif len(privkey) == 32: return point_to_hex(base10_multiply(G,decode(privkey,16))) elif len(privkey) == 33: return compress(base10_multiply(G,decode(privkey[:-1],16)),'bin') else: return privkey_to_pubkey(b58check_to_hex(privkey))
If one uses base ten like the numbers used at the top of the main area. I am having issues checking this as to how it works. It looks like it is a simple gx times private key Mod P to get the public x part. Then do this for Y. This does not work in a program like mathematica for checking it.
Does anyone know the regular math involved for taking the private key in base ten and using the parameters from the main starting area to generate the public x,y? Also the fips big endian thing is a real pain. Thanks.
|
|
|
The cartoon character on the green hill will have to go. Just a thought. If I were to do it I would approach the name and make it sexy. You will have to have an idea of what you are looking for. On the front end and then ongoing. Take the two B's and make them an overlay of a women's eyes. If you want to stick with the right as being the bitcoin symbol then make that the iris. Never miss the white of the eyes and size relative. The other will have to be contrasting, yes the other eye. Changing irises in the same sex cause fear and interest and in the other attraction. Why, I do not know. Just then choose the font. This will be tough. You will have to have someone on hand to choose the font for the face. You can choose eyes only. Maybe the entire face. That can be automatic.
Either way you have given all of the suggestion you will ever need. This is a leg up on the cartoon character or just a standard face model. You then have a template for making a changeable mathematical copyrightable system that you can use for any product. Maybe products that you will decide on.
|
|
|
OK on that. What I am trying to d is write up a paper on all of this. It is hard to do something will make sense to a laymen. I can explain the public point to SHA 256 and then repmd 160 to base 58 so that a human can possibly remember it. All of that is good. The issue that is up front is in the wallet creation. Not being a programmer I am looking at it and this does not make sense. The main problem is that in looking at the code it first make a random seed of 64 bits. Then it somehow does the Koblitz curve line private public set from this. The public address is an 04 then two 256 bit line points. Even though there are big endian they normally settle in a higher range on purpose by how the code is written. I also cannot figure out how to decode this into the negative values. Look at the signatures are here: https://en.bitcoin.it/wiki/Protocol_specificationThen look at Satoshi zero here: http://blockexplorer.com/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26fThen the associated wallet for the 50 coins which has grown: http://blockexplorer.com/address/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa Jim over at multibit thinks that maybe Reiner can talk on this. I am just wondering how to walk a laymen through this process to have it make sense.
|
|
|
How does the system make the base 58 public addresses. There is also a public key and private. Those look to be in hex. Does the system first come up with the 58 number or does it somehow work the other way?
|
|
|
|