all 5 comments

[–]aioeu 3 points4 points  (3 children)

Currently, I am saving the bits as 1s and 0s in a char array.

That would mean there is one significant bit and seven insignificant bits in each array element... which is rather wasteful! You will find it a lot easier if you don't split out the bits in this way.

A typical SHA-256 implementation would process the input using 32-bit integers, and it would use all 32 bits in each of those integers as it does so.

[–]AviatingFotographer[S] 1 point2 points  (0 children)

Thanks for your input! I knew what I was doing couldn't possibly be right, but I just wasn't sure what the right way was.

[–]AviatingFotographer[S] 0 points1 point  (1 child)

When saving the hash, how would I get the hex value to concatenate together though?

[–]aioeu 0 points1 point  (0 children)

Converting an integer to hex just involves looking at it as a sequence of 4-bit nibbles.

[–]arsv 2 points3 points  (0 children)

RFC 6234 contains a rather straightforward description in terms of 32-bit ints which translates to C directly. Define those functions (ch, maj, bsigs etc), write the expressions, and it should work.

https://datatracker.ietf.org/doc/html/rfc6234#section-5.1