Bitcoin Forum
May 08, 2024, 12:20:34 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Double hashing question  (Read 511 times)
b129 (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
April 29, 2013, 09:49:24 PM
 #1

Am trying to verify some code I have written:

I am using a sample message "hello" and run a single sha256 hash and get the correct result, but try to hash the result and don't get the same result for the 2nd hash....

I am referencing the following page:
https://en.bitcoin.it/wiki/Protocol_specification

My single sha256 hash is verified, and agrees with the following:
http://www.xorbin.com/tools/sha256-hash-calculator

Is there a step I am missing for calculating the second hash?

Sha256("hello") = "2cf24dba...."
Sha256("2cf24dba....") <> "9595c9d..."
1715170834
Hero Member
*
Offline Offline

Posts: 1715170834

View Profile Personal Message (Offline)

Ignore
1715170834
Reply with quote  #2

1715170834
Report to moderator
1715170834
Hero Member
*
Offline Offline

Posts: 1715170834

View Profile Personal Message (Offline)

Ignore
1715170834
Reply with quote  #2

1715170834
Report to moderator
1715170834
Hero Member
*
Offline Offline

Posts: 1715170834

View Profile Personal Message (Offline)

Ignore
1715170834
Reply with quote  #2

1715170834
Report to moderator
Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715170834
Hero Member
*
Offline Offline

Posts: 1715170834

View Profile Personal Message (Offline)

Ignore
1715170834
Reply with quote  #2

1715170834
Report to moderator
1715170834
Hero Member
*
Offline Offline

Posts: 1715170834

View Profile Personal Message (Offline)

Ignore
1715170834
Reply with quote  #2

1715170834
Report to moderator
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
April 30, 2013, 01:14:47 AM
 #2

Am trying to verify some code I have written:

I am using a sample message "hello" and run a single sha256 hash and get the correct result, but try to hash the result and don't get the same result for the 2nd hash....

I am referencing the following page:
https://en.bitcoin.it/wiki/Protocol_specification

My single sha256 hash is verified, and agrees with the following:
http://www.xorbin.com/tools/sha256-hash-calculator

Is there a step I am missing for calculating the second hash?

Sha256("hello") = "2cf24dba...."
Sha256("2cf24dba....") <> "9595c9d..."

I suspect you are treating the first hash as a string of alphanumeric characters instead of a block of hexcode bytes.
b129 (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
April 30, 2013, 01:28:25 AM
 #3

Good point - that should be the answer - sometimes easiest solution is right in front of you just takes someone else to notice.
b129 (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
April 30, 2013, 07:48:01 AM
 #4

Yep worked that's all it was thanks
candelone
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
April 30, 2013, 07:54:14 AM
 #5

very goog work
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!