# SHA-256 Hashing problem from binary values

For a school project we have been given some example hexadecimal numbers to hash like the following:

Len = 2 (in bits)
Msg = c0
SHA 256 - MD = 1e1cea10a23697dc97b423c259842ac12ee679d6b43f088f3c32b26dbbfb0d79


The binary representation of c0 is 11000000, but as the length is 2 units, I assume that the binary number to be hashed is 11, which corresponds to 3 in decimal. Using online hash converters, I cannot get the example hash value back. What am I doing wrong?

• To clarify: why are you converting things to binary notation? Dec 4, 2016 at 20:57
• It is given in the description of the exercise.Recall that the binary representation of c0 is 11000000. Then ● The first sample message is 2 bits in length and is 11 Dec 4, 2016 at 21:10
• 11000000 is 8 bits in length, not 2, a 0 bit is still a bit Dec 4, 2016 at 21:36

Note that representing two bits with hex value C0 is not correct. C0 represents a full byte and there is no reason to use the most significant bits rather than the lowest significant bits. Two bits set to one should simply be represented as 11 in binary.
I calculated the required result by performing a digest of the value E0 (the value with an additional padding bit set to 1, and the rest 0 valued padding bits: 11 1 0 0000), skipping the usual padding byte 80 (or 1000 0000 in binary), padding with zero valued bytes and then finally setting the (internal, encoded) length to 2. A bit messy, but it works.