<p>Your conflict is caused because you are hashing different values in the two situations. </p>

<pre><code>&gt;&gt;&gt; import hashlib
&gt;&gt;&gt; hashlib.sha256("1").hexdigest()
'6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b'
</code></pre>

<p>Your online tools are showing the hash of the string "1". </p>

<pre><code>&gt;&gt;&gt; hashlib.sha256("\x01").hexdigest()
'4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a'
</code></pre>

<p>Bitcoin script stack elements are bytes, for <code>OP_1</code> this is <code>01</code>.</p>

CC BY-SA 3.0
2015-10-18T02:33:13.897Z
@AdrianCousot I suggest marking it as the answer.
Aloha
CC BY-SA 3.0
2015-10-18T03:42:18.467Z
@PandaLion98 New users have to wait 8 hours to accept an answer. So he could do it now, but not then.
Michael Hampton
CC BY-SA 3.0
2015-10-18T06:35:10.637Z
Many thanks , I don't have enough rep to vote you
Adrian Cousot
CC BY-SA 3.0
2015-10-17T21:12:15.647Z
2015-11-19T02:42:10.563Z
2015-11-19T02:42:10.563Z
Claris
<p>I am new to bitcoin. When I use this online <a href="http://webbtc.com/script" rel="noreferrer">'Script Execution'</a> site, to calculate the SHA256 hash of 1, I get <strong>4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a</strong>
but using any other online calculator you get a different result <strong>6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b</strong>
So probably OP_SHA256 is not what I think, or something happens to input after 1 is pushed into stack. </p>

<script>
OP_SHA256 mismatch!
Adrian Cousot
# OP_SHA256 mismatch!

(Asked by: username_0 on 2015-10-17)

I am new to bitcoin. When I use this online ['Script Execution'](http://webbtc.com/script) site, to calculate the SHA256 hash of 1, I get **4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a**
but using any other online calculator you get a different result **6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b**
So probably OP\_SHA256 is not what I think, or something happens to input after 1 is pushed into stack.

**Tags:** script


---

## 1 answers

### Answer by username_1 on 2015-10-17. Score: 13 | Accepted answer

Your conflict is caused because you are hashing different values in the two situations. 
>>> import hashlib
>>> hashlib.sha256("1").hexdigest()
'6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b'

Your online tools are showing the hash of the string "1". 
>>> hashlib.sha256("\x01").hexdigest()
'4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a'

Bitcoin script stack elements are bytes, for OP_1 this is 01.

> **Comments:**
> **username_2**: @AdrianCousot I suggest marking it as the answer.  
> **username_3**: @PandaLion98 New users have to wait 8 hours to accept an answer. So he could do it now, but not then.  
> **username_0**: Many thanks , I don't have enough rep to vote you  

---

