<p>Use must use SHA256 on array of bytes, not on a hex-string representation.</p>

CC BY-SA 3.0
2013-12-30T15:08:16.580Z
2013-12-30T15:08:16.580Z
Zergatul
<pre><code>echo -n  "0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"
| sha256sum 
</code></pre>

<p>Gives: 32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce</p>

<pre><code>echo "0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"
| xxd -r -p /proc/self/fd/0 | sha256sum
</code></pre>

<p>Gives: 600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408</p>

<p>Conclusion: You hashed an ASCII representation of the public key in hexadecimal rather than the public key itself.</p>

CC BY-SA 3.0
2013-12-30T18:18:32.533Z
2013-12-30T18:18:32.533Z
David Schwartz
<p>The <a href="https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses" rel="nofollow">bitcoin wiki</a>  says this:</p>

<hr>

<h2>How to create Bitcoin Address</h2>

<p>0 - Having a private ECDSA key</p>

<pre><code>18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725
</code></pre>

<p>1 - Take the corresponding public key generated with it   </p>

<pre><code>0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
</code></pre>

<p>2 - Perform SHA-256 hashing on the public key</p>

<pre><code>600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408
</code></pre>

<hr>

<p>but when I run a sha256 on </p>

<pre><code>0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
</code></pre>

<p>I don't get </p>

<pre><code>600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408
</code></pre>

<p>What I get is</p>

<pre><code>32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce
</code></pre>

<p>what am I doing wrong?</p>

<address><sha256>
Bitcoin Address generation
Assaf Shomer
# Bitcoin Address generation

(Asked by: username_0 on 2013-12-30)

The [bitcoin wiki](https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses) says this:

---

## How to create Bitcoin Address

0 - Having a private ECDSA key

```
18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

```

1 - Take the corresponding public key generated with it

```
0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

```

2 - Perform SHA-256 hashing on the public key

```
600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

```

---

but when I run a sha256 on

```
0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

```

I don't get

```
600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408

```

What I get is

```
32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce

```

what am I doing wrong?

**Tags:** address, sha256


---

## 2 answers

### Answer by username_2 on 2013-12-30. Score: 8 | Accepted answer

```
echo -n  "0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"
| sha256sum 

```

Gives: 32511e82d56dcea68eb774094e25bab0f8bdd9bc1eca1ceeda38c7a43aceddce

```
echo "0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"
| xxd -r -p /proc/self/fd/0 | sha256sum

```

Gives: 600ffe422b4e00731a59557a5cca46cc183944191006324a447bdb2d98d4b408

Conclusion: You hashed an ASCII representation of the public key in hexadecimal rather than the public key itself.


---

### Answer by username_1 on 2013-12-30. Score: 4

Use must use SHA256 on array of bytes, not on a hex-string representation.


---

