Bitcoin Forum
August 26, 2024, 04:11:31 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Double hashing question  (Read 519 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..."
DannyHamilton
Legendary
*
Offline Offline

Activity: 3472
Merit: 4790



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!