For easy reference, lets name the various inputs and outputs from your question like so:
pre-image 1: hello
|
v
hash operation 1: SHA256
|
v
hash output 1 (aka pre-image 2): 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
|
v
hash operation 2: SHA256
|
v
hash output 2: 9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50
Pre-image 1 is binary (ASCII) data. We know this because the range of hexadecimal characters is 0-9
and a-f
, and there are characters beyond f
in pre-image 1. So hash operation 1 must be performed using a binary input.
By definition, a SHA256 hash operation always produces a 256 bit integer. We typically represent this in hexadecimal format, however it could just as correctly be written in decimal format and nothing would change:
hex: 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
decimal: 20329878786436204988385760252021328656300425018755239228739303522659023427620
(Decimal conversion using Wolfram Alpha)
Since we know that pre-image 2 is a hexadecimal number, then hash operation 2 must be performed upon a number, rather than upon binary data.
In Javascript, using the Stanford Javascript Crypto Library, the two hashes would be done like so:
var preImage1 = 'hello';
var hashOutput1 = sjcl.hash.sha256.hash(preImage1);
console.log('hash output 1: ' + sjcl.codec.hex.fromBits(hashOutput1));
var preImage2 = hashOutput1;
var hashOutput2 = sjcl.hash.sha256.hash(preImage2);
console.log('hash output 2: ' + sjcl.codec.hex.fromBits(hashOutput2));
The SJCL is clever enough to figure out the pre-image formats and perform the hash correctly in each case.
You can also do these hash operations live on my blog, here: https://analysis.null.place/how-do-the-bitcoin-mining-algorithms-work/#form10
Note how the hash output changes when you click the pre-image is hexadecimal checkbox (this only works when hexadecimal characters are present in the input).