<p>That is hex encoding, two ASCII characters per byte. </p>

<p>SHA256 output is 32 bytes, or 64 characters when hex encoded. </p>

CC BY-SA 4.0
2019-05-10T08:47:25.670Z
Yes, apparently you can store the full hash in BINARY(32). Right?
Areeb
CC BY-SA 4.0
2019-05-10T09:22:55.077Z
Right. It’s 32 binary bytes irrespective of the representation of them.
Claris
CC BY-SA 4.0
2019-05-10T08:37:44.187Z
2019-05-10T08:37:44.187Z
Claris
<p><a href="https://i.sstatic.net/0VQfB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0VQfB.png" alt="Bitcoin Block Header"></a></p>

<p>I have read that Previous Block hash takes around 32 bytes in the Block Header. Since it is a SHA256 hash which is 64 characters long, shouldn't it take 64 bytes as well? Similarly, Merkle root and other parameters.</p>

<p>Take a look at the following:
    010000009500c43a25c624520b5100adf82cb9f9da72fd2447a496bc600b0000000000006cd862370395dedf1da2841ccda0fc489e3039de5f1ccddef0e834991a65600ea6c8cb4db3936a1ae3143991</p>

<p>Length: 160</p>

<p>Apparently, it is x2 of what is actually written everywhere.</p>

<p>What kind of encoding is used here?</p>

<blockchain>
Block Header - Encoding/Serialization
Areeb
# Block Header - Encoding/Serialization

(Asked by: username_0 on 2019-05-10)

[![Bitcoin Block Header](https://i.sstatic.net/0VQfB.png)](https://i.sstatic.net/0VQfB.png)

I have read that Previous Block hash takes around 32 bytes in the Block Header. Since it is a SHA256 hash which is 64 characters long, shouldn't it take 64 bytes as well? Similarly, Merkle root and other parameters.

Take a look at the following:
010000009500c43a25c624520b5100adf82cb9f9da72fd2447a496bc600b0000000000006cd862370395dedf1da2841ccda0fc489e3039de5f1ccddef0e834991a65600ea6c8cb4db3936a1ae3143991

Length: 160

Apparently, it is x2 of what is actually written everywhere.

What kind of encoding is used here?

**Tags:** blockchain


---

## 1 answers

### Answer by username_1 on 2019-05-10. Score: 4 | Accepted answer

That is hex encoding, two ASCII characters per byte.

SHA256 output is 32 bytes, or 64 characters when hex encoded.

> **Comments:**
> **username_0**: Yes, apparently you can store the full hash in BINARY(32). Right?  
> **username_1**: Right. It’s 32 binary bytes irrespective of the representation of them.  

---

