Author

Topic: Code lines for keys generation (Read 975 times)

kjj
legendary
Activity: 1302
Merit: 1026
September 26, 2012, 12:43:26 PM
#3
The "short" version:

generate a random 256 bit number.  Use a high quality entropy source.
make sure it is less than the number of possible spots in the curve you are using (start over if it is)
-> this is your private key

do an elliptic curve multiply of your curve's generator point by the private key
-> this is your public key

Converting those keys to/from other formats (like bitcoin addresses or WIF) is another big topic.
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
September 21, 2012, 07:07:41 PM
#2
Those lines you are talking about are not exactly the same across different languages. Look here https://github.com/bitcoin/bitcoin/blob/master/src/key.cpp

The whole file is relevent, but you also might want to take a look at void CKey::MakeNewKey(bool fCompressed)
hero member
Activity: 931
Merit: 500
September 21, 2012, 06:49:04 PM
#1

What are the lines of code that actually generate the public/private keys for Bitcoin?

I'd like to know where to look (search for words and commands) when inspecting a source code, in the original client and others alternatives clients as well (blockchain.info, bitaddress.org etc.)

Thanks.

Jump to: