Bitcoin Forum
April 27, 2024, 04:12:46 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Double hashing question  (Read 510 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..."
1714191166
Hero Member
*
Offline Offline

Posts: 1714191166

View Profile Personal Message (Offline)

Ignore
1714191166
Reply with quote  #2

1714191166
Report to moderator
1714191166
Hero Member
*
Offline Offline

Posts: 1714191166

View Profile Personal Message (Offline)

Ignore
1714191166
Reply with quote  #2

1714191166
Report to moderator
The forum was founded in 2009 by Satoshi and Sirius. It replaced a SourceForge forum.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714191166
Hero Member
*
Offline Offline

Posts: 1714191166

View Profile Personal Message (Offline)

Ignore
1714191166
Reply with quote  #2

1714191166
Report to moderator
DannyHamilton
Legendary
*
Online Online

Activity: 3374
Merit: 4610



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!