Bitcoin Forum
April 26, 2024, 07:05:16 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Books on SHA-256  (Read 1158 times)
evansste (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile WWW
September 04, 2015, 02:36:21 AM
 #1

I'm trying to learn complete details about the SHA-256 protocol.  Does anyone know of any books that they would recommend for learning everything there is to know about the algorithm and how it works?

I would like a formal, detailed explanation of SHA-256 so I first tried to find text books on cryptography.  I have found many cryptography text books, but they only seem to MENTION SHA-256.  They never give any real detail in terms of how the function works specifically.  I want to understand how it works.  I know that someone knows how it works since people are able to write programs, and program FPGAs, that actually carry out the process.  But what is the process?  What's the actual, detailed process that occurs to an input that is operated on by the SHA-256 hash algorithm?

If anyone knows of any text books that explain this kind of detail, then I'd love to hear from you.  Thanks for your time.
1714115116
Hero Member
*
Offline Offline

Posts: 1714115116

View Profile Personal Message (Offline)

Ignore
1714115116
Reply with quote  #2

1714115116
Report to moderator
"This isn't the kind of software where we can leave so many unresolved bugs that we need a tracker for them." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714115116
Hero Member
*
Offline Offline

Posts: 1714115116

View Profile Personal Message (Offline)

Ignore
1714115116
Reply with quote  #2

1714115116
Report to moderator
1714115116
Hero Member
*
Offline Offline

Posts: 1714115116

View Profile Personal Message (Offline)

Ignore
1714115116
Reply with quote  #2

1714115116
Report to moderator
1714115116
Hero Member
*
Offline Offline

Posts: 1714115116

View Profile Personal Message (Offline)

Ignore
1714115116
Reply with quote  #2

1714115116
Report to moderator
achow101
Staff
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
September 04, 2015, 02:44:51 AM
 #2

Well wikipedia is generally useful https://en.wikipedia.org/wiki/SHA-2.
But NIST (the agency that created and approved SHA2) has a website for it http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html#Approved Algorithms and a publication that specifies the standard for multiple SHA algorithms, including SHA 256 here: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf

evansste (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile WWW
September 04, 2015, 03:56:15 PM
 #3

Thanks, knightdk.  You just made my day.

The pdf, that you provided, is exactly what I was looking for.  After looking it over, I'm beginning to understand why textbooks tend to shy away from a detailed explanation of the SHA-256 hash algorithm.  The bottom line is that it's fairly complex.  A text book would have to dedicate an entire section on the algorithm, and that section would simply be a reiteration of the document that you've just provided.  However, I still feel that a text book, on cryptography, should at least clearly reference this information directly, as you have done.  They could simply state that the details are beyond the scope of the book and could be found at the link that you've given.

I get the feeling that as bitcoin becomes more mainstream, the document, which you've provided, will begin to find its way into the appendices of future cryptography text books.  If bitcoin sticks around, as many predict, I can't imagine this not happening.  The SHA-256 hash algorithm is too central to bitcoin cryptography to be ignored.  As long as the bitcoin protocol remains as is, SHA-256 won't be able to be overlooked.

Thanks so much again for what you've provided.  It truly is exactly what I was looking for.
tl121
Sr. Member
****
Offline Offline

Activity: 278
Merit: 251


View Profile
September 06, 2015, 03:33:49 PM
 #4

You might find the following video on computing SHA256 by hand interesting (or at least amusing).

https://www.youtube.com/watch?v=y3dqhixzGVo



bkelly13
Member
**
Offline Offline

Activity: 63
Merit: 33


View Profile
September 30, 2022, 12:46:25 AM
 #5

Replying to achow101
Followed this link: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
and started reading about Secure Hash Standard.  From the explanation, item 3.

Quote
… When a message of any length less than 264 bits (for SHA-1, SHA-224 and SHA-256) or less than 2128 bits (for SHA-384, SHA-512, SHA-512/224 and SHA-512/256) is input to a hash algorithm, the result is an output called a message digest…
.

I was under the impression that the hash function, specifically SHA256 for my interest, can be used on any length input to create a “digest” or hashed function.  By that I am thinking of the example of submitting a document to the hash function and getting a “digest” (right word?) that can be used to verity that the document has not been changed.   But that explanation specifically states less than 264 bits.
Please set me straight.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
September 30, 2022, 04:15:51 AM
 #6

I was under the impression that the hash function, specifically SHA256 for my interest, can be used on any length input to create a “digest” or hashed function.  By that I am thinking of the example of submitting a document to the hash function and getting a “digest” (right word?) that can be used to verity that the document has not been changed.   But that explanation specifically states less than 264 bits.
Please set me straight.
The limit of 2^64 bits is basically a theoretical limit rather than a practical one. 2^64 bits is 2.3 exabytes which is way larger than a file would ever practically be.

This limit comes from the padding method used by SHA256. This padding adds a single bit, and then the length of the message in bits plus that added "1". This length is stored in a fixed width integer. For SHA256, it's 64 bits. Thus the message must not be larger than 2^64-1 bits as otherwise it will overflow the maximum of a 64 bit integer.

bkelly13
Member
**
Offline Offline

Activity: 63
Merit: 33


View Profile
September 30, 2022, 04:48:54 AM
Last edit: September 30, 2022, 04:27:00 PM by bkelly13
 #7

Thank you for your time.  I now see my error.  I read 264 bits rather than 264 bits.  Yeah, I have a bit of lesdexia.   And I read it a couple of times.

That said, and since you are better acquainted with the subject than I, can you explain, in simple words, the meaning of  "message schedule."  I am trying to follow it as a group of bits/bytes/words/etc, but, in plain speaking words, why have the two words "message" and "schedule" been selected as the name for such entity?

Edit
I have read the introduction again and focused on a few sentences.  So far, my understanding is this.

First the input is parsed and padded into a specified format. 

Second it is hashed.  The result of the hashing is an array of bits (organized as bytes/words, etc). 

This array is the message schedule.  Creating this message schedule is the real work of the SHA process. 

Finally, from that message schedule, the final message digest is created.  I have not progressed that far, but presume that last step, while critical, is relatively simple.

Thank you for your time and patience.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!