Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: release on November 04, 2020, 06:47:07 AM



Title: Help with 256 bit generator
Post by: release on November 04, 2020, 06:47:07 AM
Hi guys I am trying learn the relationship between 256 bit encryption and bitcoins addresses and private keys. I remember something ages ago which showed the bits (256) corresponding with the private key. Can someone point me in the direction of such a resource.

Thanks


Title: Re: Help with 256 bit generator
Post by: Coding Enthusiast on November 04, 2020, 08:28:30 AM
Hi guys I am trying learn the relationship between 256 bit encryption and bitcoins addresses and private keys.
For starters, there is no "encryption" in this process.
Choose a number between 1 and curve order --> calculate public key point[1] --> compute hash of it[2] <--> encode the hash to get the address[3]
--> represents a one way operation while <--> represents a reversible (two way) operation.

I remember something ages ago which showed the bits (256) corresponding with the private key. Can someone point me in the direction of such a resource.
In asymmetric cryptography using elliptic curves[4] the private keys are numbers between 1 and the curve order N. In bitcoin we are using a curve called secp256k1 which is a 256-bit curve that has an order that is slightly below 2256 (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141).
In other words bitcoin private keys are random numbers chosen in this range.

[1] https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication
[2] Depending on the address type (or more accurately the pubkey script type) the hash algorithm used can be different, but in majority of cases it is RIPEMD160 of SHA256 of 33 or 65 byte public key
[3] https://en.bitcoin.it/wiki/Base58Check_encoding or https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki again depending on the address type
[4] https://en.wikipedia.org/wiki/Elliptic-curve_cryptography and https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/


Title: Re: Help with 256 bit generator
Post by: PawGo on November 04, 2020, 08:31:39 AM
Hi guys I am trying learn the relationship between 256 bit encryption and bitcoins addresses and private keys. I remember something ages ago which showed the bits (256) corresponding with the private key. Can someone point me in the direction of such a resource.

Thanks

Maybe this:
https://btckeygen.com/
and sources for running on your computer: https://github.com/MrFreeDragon/VisualBTC


Title: Re: Help with 256 bit generator
Post by: odolvlobo on November 05, 2020, 05:52:45 AM
Hi guys I am trying learn the relationship between 256 bit encryption and bitcoins addresses and private keys. I remember something ages ago which showed the bits (256) corresponding with the private key. Can someone point me in the direction of such a resource.

Thanks

You can find some good (but dated) step-by-step demos here: https://gobittest.appspot.com/


Title: Re: Help with 256 bit generator
Post by: PawGo on November 05, 2020, 07:41:07 AM
Hi guys I am trying learn the relationship between 256 bit encryption and bitcoins addresses and private keys. I remember something ages ago which showed the bits (256) corresponding with the private key. Can someone point me in the direction of such a resource.

Thanks

Maybe this:
https://btckeygen.com/
and sources for running on your computer: https://github.com/MrFreeDragon/VisualBTC


Or this: https://learnmeabitcoin.com/technical/
It shows the whole sequence of transformations: private key->public key->hash->address etc.


Title: Re: Help with 256 bit generator
Post by: Saint-loup on November 08, 2020, 02:19:21 PM
Hi guys I am trying learn the relationship between 256 bit encryption and bitcoins addresses and private keys. I remember something ages ago which showed the bits (256) corresponding with the private key. Can someone point me in the direction of such a resource.

Thanks
Here you can see how a private key in WIF format is computed from its hexadecimal number.

https://en.bitcoin.it/wiki/Wallet_import_format

An hexadecimal number is just a binary(or even decimal) number converted in hexadecimal base, so you can simply do the conversion from your binary string with a calculator before applying this algorithm.

PS : all the tools above are very interesting, I only knew the one from MrFreeDragon. Thank you for sharing them PawGo and odolvlobo