<p>actually the public key:</p>

<p><code>0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6</code> </p>

<p>is hex string, so you need transform it to bytes before you calculate the correct value.</p>

<p>You can use Python3 to get the correct value:</p>

<pre><code>&gt;&gt;&gt; import hashlib
&gt;&gt;&gt; public_key_hexstr = '0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6'
&gt;&gt;&gt; public_key_bytes = bytes.fromhex(public_key_hexstr)
&gt;&gt;&gt; hashlib.sha256(public_key_bytes).hexdigest()
'600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408'
</code></pre>

<p>Or you can install bx tool in macOS using brew:</p>

<pre><code>$ brew install bx
</code></pre>

<p>then:</p>

<pre><code>$ bx sha256 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408
</code></pre>

CC BY-SA 4.0
2019-03-08T09:32:28.777Z
2019-03-08T09:38:23.513Z
2019-03-08T09:38:23.513Z
zruijie
<p>ASCII-encoded hex strings are easily handled by <a href="https://github.com/libbitcoin/libbitcoin-explorer/wiki" rel="nofollow noreferrer">Bitcoin-Explorer</a>.  The following recreates results from <a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses" rel="nofollow noreferrer">en.bitcoin.it</a> properly:</p>

<p><code>% echo -n 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx base16-decode | shasum -a 256</code>
<strong>600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408  -</strong></p>

<p><code>% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx sha256</code></p>

<p><strong>600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408</strong></p>

<p><code>% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx sha256 | bx ripemd160 | bx base58check-encode -v 0</code></p>

<p><strong>16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM</strong></p>

<p><code>% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx ec-to-address -v 0</code>
<strong>16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM</strong></p>

CC BY-SA 4.0
2016-12-25T01:11:00.683Z
2019-03-07T18:27:34.550Z
2019-03-07T18:27:34.550Z
skaht
<p>The problem is that you're treating the pubkey as string data. What you need to do is treat it as raw binary hexadecimal. If you use <a href="http://www.fileformat.info/tool/hash.htm?hex=0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6">fileformat.info</a> and calculate it using Binary Hash hex bytes you do indeed get <code>600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408</code>.</p>

CC BY-SA 3.0
2016-03-31T03:54:34.340Z
Ah, of course. Rookie mistake! Cheers.
cloudnthings
CC BY-SA 3.0
2016-03-31T03:26:56.580Z
2016-03-31T03:26:56.580Z
greatwolf
<p>From the wiki page <a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses" rel="nofollow">https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses</a> the example of "How to Create Bitcoin Address" shows the SHA256 of:</p>

<p>0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 </p>

<p>to be</p>

<p>600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408</p>

<p>If I use this online tool <a href="http://www.xorbin.com/tools/sha256-hash-calculator" rel="nofollow">http://www.xorbin.com/tools/sha256-hash-calculator</a></p>

<p>I get: 32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce</p>

<p>Am I missing something? </p>

<sha256><address-generation>
Is the SHA256 value in the bitcoin address wiki accurate?
cloudnthings
# Is the SHA256 value in the bitcoin address wiki accurate?

(Asked by: username_0 on 2016-03-31)

From the wiki page <https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses> the example of "How to Create Bitcoin Address" shows the SHA256 of:

0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

to be

600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

If I use this online tool <http://www.xorbin.com/tools/sha256-hash-calculator>

I get: 32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce

Am I missing something?

**Tags:** sha256, address-generation


---

## 3 answers

### Answer by username_3 on 2016-03-31. Score: 10 | Accepted answer

The problem is that you're treating the pubkey as string data. What you need to do is treat it as raw binary hexadecimal. If you use [fileformat.info](http://www.fileformat.info/tool/hash.htm?hex=0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6) and calculate it using Binary Hash hex bytes you do indeed get `600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408`.

> **Comments:**
> **username_0**: Ah, of course. Rookie mistake! Cheers.  

---

### Answer by username_1 on 2019-03-08. Score: 1

actually the public key:

`0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6`

is hex string, so you need transform it to bytes before you calculate the correct value.

You can use Python3 to get the correct value:

```
>>> import hashlib
>>> public_key_hexstr = '0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6'
>>> public_key_bytes = bytes.fromhex(public_key_hexstr)
>>> hashlib.sha256(public_key_bytes).hexdigest()
'600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408'

```

Or you can install bx tool in macOS using brew:

```
$ brew install bx

```

then:

```
$ bx sha256 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408

```


---

### Answer by username_2 on 2016-12-25. Score: 0

ASCII-encoded hex strings are easily handled by [Bitcoin-Explorer](https://github.com/libbitcoin/libbitcoin-explorer/wiki). The following recreates results from [en.bitcoin.it](https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses) properly:

`% echo -n 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx base16-decode | shasum -a 256`
**600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408 -**

`% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx sha256`

**600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408**

`% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx sha256 | bx ripemd160 | bx base58check-encode -v 0`

**16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM**

`% echo 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 | bx ec-to-address -v 0`
**16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM**


---

