Author

Topic: spreadsheet showing SHA-256 calculations in step-by-step detail (Read 8558 times)

hero member
Activity: 709
Merit: 503
I've added some "instructions" within the sheet.  Enjoy.
hero member
Activity: 709
Merit: 503
Since you are using Excel maybe this VB.net code may help you:
http://www.reddit.com/r/Bitcoin/comments/1utg95/how_do_you_calculate_a_public_key_from_the/celjnof
Although you'll need ecPoint object which may not be available through Excel.

If you want to roll your own EC calculations good starting points are here:
http://arstechnica.com/security/2013/10/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/
http://procbits.com/2013/08/27/generating-a-bitcoin-address-with-javascript

It could be done, there are some already written attempts in Python, but I can tell you it's some work. IMHO it's best to enhance your table to accept longer strings, and leave Eliptic curve cryptography out of the Excel.
Although I started off in Excel at the very beginning, I am now working in Google sheet.  I found the Google sheet script engine to be *very* slow.

Thank you for the pointers but EC looks a little tougher than I am willing to take on at the moment.

I am working on my SHA256 Google sheet to get it to handle longer strings, i.e. 119 (as opposed to just 55), right now; tedious.  I am wondering when I might trip over some limitation, e.g. number of tabs, etc., in Google sheet.
legendary
Activity: 1974
Merit: 1077
^ Will code for Bitcoins
Since you are using Excel maybe this VB.net code may help you:
http://www.reddit.com/r/Bitcoin/comments/1utg95/how_do_you_calculate_a_public_key_from_the/celjnof
Although you'll need ecPoint object which may not be available through Excel.

If you want to roll your own EC calculations good starting points are here:
http://arstechnica.com/security/2013/10/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/
http://procbits.com/2013/08/27/generating-a-bitcoin-address-with-javascript

It could be done, there are some already written attempts in Python, but I can tell you it's some work. IMHO it's best to enhance your table to accept longer strings, and leave Eliptic curve cryptography out of the Excel.
hero member
Activity: 709
Merit: 503
I'm thinking about my next enhancement.  Any suggestions/requests?
There was a thread https://bitcointalksearch.org/topic/can-i-create-a-bitcoin-address-with-pen-and-paper-816123 where someone asked about generating a BTC address by hand. Basic idea would be to start with a number as private key and go from there.
I am willing; I will research it.
Oh dear; per https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses, it requires the SHA256 hash of 65 bytes.  As it stands as of now my sheet only handles up to 55 printable ASCII characters.  I will need to enhance it to handle one more chunk (medium effort) and binary/hex input (easy).
You will also need RIPEMD-160, BASE58Check and be able to get a public ECDSA key from a private one. All sounds complicated on paper.
Far worse; the very first step involves "Having a private ECDSA key" which looks to be crazy hard to do in a sheet.
From what I read https://en.bitcoin.it/wiki/Private_key its "just" a number between 0x0 and 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140 which would be given as input by you.
Well, ok, yes, the very first step is not too tough but per http://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm it gets hard fast.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
I'm thinking about my next enhancement.  Any suggestions/requests?
There was a thread https://bitcointalksearch.org/topic/can-i-create-a-bitcoin-address-with-pen-and-paper-816123 where someone asked about generating a BTC address by hand. Basic idea would be to start with a number as private key and go from there.
I am willing; I will research it.
Oh dear; per https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses, it requires the SHA256 hash of 65 bytes.  As it stands as of now my sheet only handles up to 55 printable ASCII characters.  I will need to enhance it to handle one more chunk (medium effort) and binary/hex input (easy).

You will also need RIPEMD-160, BASE58Check and be able to get a public ECDSA key from a private one. All sounds complicated on paper.

Far worse; the very first step involves "Having a private ECDSA key" which looks to be crazy hard to do in a sheet.

From what I read [1] its "just" a number between 0x0 and 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140 which would be given as input by you.

[1] https://en.bitcoin.it/wiki/Private_key
hero member
Activity: 709
Merit: 503
I'm thinking about my next enhancement.  Any suggestions/requests?
There was a thread https://bitcointalksearch.org/topic/can-i-create-a-bitcoin-address-with-pen-and-paper-816123 where someone asked about generating a BTC address by hand. Basic idea would be to start with a number as private key and go from there.
I am willing; I will research it.
Oh dear; per https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses, it requires the SHA256 hash of 65 bytes.  As it stands as of now my sheet only handles up to 55 printable ASCII characters.  I will need to enhance it to handle one more chunk (medium effort) and binary/hex input (easy).

Far worse; the very first step involves "Having a private ECDSA key" which looks to be crazy hard to do in a sheet.
hero member
Activity: 709
Merit: 503
I'm thinking about my next enhancement.  Any suggestions/requests?
There was a thread https://bitcointalksearch.org/topic/can-i-create-a-bitcoin-address-with-pen-and-paper-816123 where someone asked about generating a BTC address by hand. Basic idea would be to start with a number as private key and go from there.
I am willing; I will research it.
hero member
Activity: 709
Merit: 503
Is there a way to type in a string to hash and get the SHA256 of it? I would like to compare to results to something like http://www.xorbin.com/tools/sha256-hash-calculator.
Copy the sheet (File->Make a copy...) (it is now standalone, i.e. it no longer uses any script) and then in your copy go to 'input'!B2 and enter up to 55 printable ASCII characters.  The resulting 512-bit hash will be displayed as 64 hex-digits at 'post-round 64'!A10.

I used that same site to double check the results of;

{the null string} (leave the cell empty)
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

abc
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

,.<>;':"/?[]\{}|`~!@#$%^&*()_-+=
55ef293e848487fb2673965531ef1777332307044b178f44fa970f63ed251125

I am content.
member
Activity: 98
Merit: 10
Is there a way to type in a string to hash and get the SHA256 of it? I would like to compare to results to something like http://www.xorbin.com/tools/sha256-hash-calculator.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
I'm thinking about my next enhancement.  Any suggestions/requests?

There was a thread [1] where someone asked about generating a BTC address by hand. Basic idea would be to start with a number as private key and go from there.


[1] found it https://bitcointalksearch.org/topic/can-i-create-a-bitcoin-address-with-pen-and-paper-816123
hero member
Activity: 709
Merit: 503
I'm thinking about my next enhancement.  Any suggestions/requests?
hero member
Activity: 709
Merit: 503
donations to 17MCh7jJ4dHU5iAfLPv2t8hdjGDDzn95DK
hero member
Activity: 709
Merit: 503
legendary
Activity: 1974
Merit: 1077
^ Will code for Bitcoins
hero member
Activity: 709
Merit: 503
https://docs.google.com/spreadsheets/d/1mOTrqckdetCoRxY5QkVcyQ7Z0gcYIH-Dc0tu7t9f7tw now works.  It computes the SHA-256 hash of the null string or a string of up to 55 printable ASCII characters.  It does so from scratch, so to speak; it calculates the 2 set of constants.  All steps are fully revealed demonstrating the intricate details of the algorithm.

Ken Shirriff was my inspiration.  http://www.righto.com/2014/09/mining-bitcoin-with-pencil-and-paper.html
Jump to: