user2375: The Bitcoin Protocol-specification gives an example of double-SHA-256 encoding. 

hello
  2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 (first round of sha-256)
  9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50 (second round of sha-256)

I've tried various SHA256 calculators and the first encoding matches no problem, but the second always resolves to

d7914fe546b684688bb95f4f888a92dfc680603a75f23eb823658031fff766d9

I've also tried UPPERCASE and swapping the byte endianness.

user15492: For the second round of sha256, you need to hash the raw binary output from the first round, not the textual version.
A sha256 hash is 256 bits, or 32 bytes. Thus for the second round you should be hashing a piece of data that's 32 bytes. When hashing a hexadecimal string as the literal input for the second round, your data is 64 bytes.
Try a hashing tool that can interpret hexadecimal input. For example see here, copy/paste the hash to the input field and check the 'Hex' checkbox.

user1409: You want to work with the digests, not the hex strings.
Here's some Ruby:
require 'digest'
d = Digest::SHA2.new 256
d2 = Digest::SHA2.new 256
d << 'hello'
d.to_s
d2 << d.digest
d2.to_s

This will be the output from irb:
1.9.3p194 :001 > require 'digest'
 => true 
1.9.3p194 :003 >   d = Digest::SHA2.new 256
 => #<Digest::SHA2:256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855> 
1.9.3p194 :004 > d2 = Digest::SHA2.new 256
 => #<Digest::SHA2:256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855> 
1.9.3p194 :005 > d << 'hello'
 => #<Digest::SHA2:256 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824> 
1.9.3p194 :006 > d.to_s
 => "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824" 
1.9.3p194 :007 > d2 << d.digest
 => #<Digest::SHA2:256 9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50> 
1.9.3p194 :008 > d2.to_s
 => "9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50"

Here's the same thing in Python:
import hashlib
d = hashlib.sha256(b"hello")
d2 = hashlib.sha256()
d.hexdigest()
d2.update(d.digest())
d2.hexdigest()

And the output from within a Python shell:
>>> d = hashlib.sha256(b"hello")
>>> d2 = hashlib.sha256()
>>> d.hexdigest()
'2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'
>>> d2.update(d.digest())
>>> d2.hexdigest()
'9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50'


user403: You're hashing the hexadecimal representation of the first hash. You need to hash the actual hash -- the binary data that the hex represents.
Try this:
$ echo -n hello |openssl dgst -sha256 -binary |openssl dgst -sha256


2375: <p>The Bitcoin <a href="https://en.bitcoin.it/wiki/Protocol_specification#Hashes">Protocol-specification</a> gives an example of double-SHA-256 encoding. </p>

<blockquote>
  <p>hello<br>
  2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 (first round of sha-256)<br>
  9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50 (second round of sha-256)</p>
</blockquote>

<p>I've tried various SHA256 <a href="http://www.xorbin.com/tools/sha256-hash-calculator">calculators</a> and the first encoding matches no problem, but the second always resolves to</p>

<blockquote>
  <p>d7914fe546b684688bb95f4f888a92dfc680603a75f23eb823658031fff766d9</p>
</blockquote>

<p>I've also tried UPPERCASE and swapping the byte endianness.</p>
 15492: <p>For the second round of sha256, you need to hash the raw binary output from the first round, not the textual version.</p>

<p>A sha256 hash is 256 bits, or 32 bytes. Thus for the second round you should be hashing a piece of data that's 32 bytes. When hashing a hexadecimal string as the literal input for the second round, your data is 64 bytes.</p>

<p>Try a hashing tool that can interpret hexadecimal input. For example <a href="http://anyhash.com/sha256?hello" rel="noreferrer">see here</a>, copy/paste the hash to the input field and check the 'Hex' checkbox.</p>
 1409: <p>You want to work with the digests, not the hex strings.</p>

<p>Here's some Ruby:</p>

<pre><code>require 'digest'
d = Digest::SHA2.new 256
d2 = Digest::SHA2.new 256
d &lt;&lt; 'hello'
d.to_s
d2 &lt;&lt; d.digest
d2.to_s
</code></pre>

<p>This will be the output from <code>irb</code>:</p>

<pre><code>1.9.3p194 :001 &gt; require 'digest'
 =&gt; true 
1.9.3p194 :003 &gt;   d = Digest::SHA2.new 256
 =&gt; #&lt;Digest::SHA2:256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855&gt; 
1.9.3p194 :004 &gt; d2 = Digest::SHA2.new 256
 =&gt; #&lt;Digest::SHA2:256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855&gt; 
1.9.3p194 :005 &gt; d &lt;&lt; 'hello'
 =&gt; #&lt;Digest::SHA2:256 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824&gt; 
1.9.3p194 :006 &gt; d.to_s
 =&gt; "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824" 
1.9.3p194 :007 &gt; d2 &lt;&lt; d.digest
 =&gt; #&lt;Digest::SHA2:256 9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50&gt; 
1.9.3p194 :008 &gt; d2.to_s
 =&gt; "9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50"
</code></pre>

<p>Here's the same thing in Python:</p>

<pre><code>import hashlib
d = hashlib.sha256(b"hello")
d2 = hashlib.sha256()
d.hexdigest()
d2.update(d.digest())
d2.hexdigest()
</code></pre>

<p>And the output from within a Python shell:</p>

<pre><code>&gt;&gt;&gt; d = hashlib.sha256(b"hello")
&gt;&gt;&gt; d2 = hashlib.sha256()
&gt;&gt;&gt; d.hexdigest()
'2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'
&gt;&gt;&gt; d2.update(d.digest())
&gt;&gt;&gt; d2.hexdigest()
'9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50'
</code></pre>
 403: <p>You're hashing the hexadecimal representation of the first hash. You need to hash the actual hash -- the binary data that the hex represents.</p>

<p>Try this:</p>

<pre><code>$ echo -n hello |openssl dgst -sha256 -binary |openssl dgst -sha256
</code></pre>
