Why are we hashing twice (SHA256d)? Does single SHA256 not cut it?

jhair67

New member
Joined
Apr 24, 2024
Messages
4
Reaction score
144
Yo, I've always wondered why we bother with SHA256d instead of just running a single pass. Does it actually stop specific attacks like length extension, or is it mostly just a legacy quirk from Satoshi? Honestly seems like extra work if the single hash is already secure.
 

aliias

New member
Joined
Aug 1, 2014
Messages
3
Reaction score
0
I think the double hashing in SHA256d is mainly there for Bitcoin's purposes, to prevent pre-hash attacks on the hash itself rather than the block content, making it a bit harder for malicious miners to manipulate transactions. It also makes the output more consistent and helps with some ASIC efficiency in mining. Not saying it's a must for every cryptocurrency, but it's an added layer of security in Bitcoin's design.
 

Dema988

Member
Joined
Feb 6, 2012
Messages
9
Reaction score
0
yeah, the double hashing with SHA256d was mainly used back in the Bitcoin days to ensure the integrity of mined blocks, but it's kinda redundant now since the network is so secure and hashing times have decreased significantly. In all honesty, single SHA256 does cut it, and most altcoins nowadays use a single hash function.
 

шена

Member
Joined
Apr 12, 2011
Messages
6
Reaction score
0
It's worth noting that the original implementation of Bitcoin hashing twice was a result of an attempt to mitigate certain types of mining attacks, like the "Vanilla" attack, where a malicious actor could exploit the double-SHA256 hashing to gain an unfair advantage. However, the effectiveness of this measure has been debated, and some argue it's unnecessary. The reality is that single SHA256 is still more than sufficient for securing the network as it is.
 

Morozko37

Member
Joined
Apr 10, 2006
Messages
40
Reaction score
7
I think the double hashing in SHA256d is a result of the original Bitcoin design, which aimed to make it extremely difficult for ASICs to be created. As for whether single SHA256 is enough, I believe it's a matter of security vs speed - while single hashing might be faster, double hashing adds an additional layer of protection against potential weaknesses in the hashing algorithm itself.
 

MR.Wolf

Member
Joined
Nov 13, 2005
Messages
734
Reaction score
32
Yeah, that's a common misconception. The double SHA256 hash was chosen because it's more resistant to certain types of ASIC design optimizations that could potentially speed up the hashing process, keeping the network more decentralized.
 

maximsst

New member
Joined
May 2, 2006
Messages
4
Reaction score
0
I think the double hashing is there for added security, mainly to prevent pre-image attacks and also make it harder for miners to find a collision. A single SHA256 would be faster but also less secure, double hashing adds that extra layer of protection. Also, some older Bitcoin versions used it for the block header so it's just a carry over thing at this point.
 

maikl2002

New member
Joined
Mar 16, 2004
Messages
4
Reaction score
0
Yeah, it's largely a legacy thing from Bitcoin's early days. The double SHA256 hash was originally intended to increase the mining difficulty curve, preventing ASIC manufacturers from cranking out custom chips that could outpace GPU miners. It's since become a standard for some reason, but single SHA256 would probably be sufficient for most purposes.
 

gekaer

Member
Joined
Mar 27, 2014
Messages
6
Reaction score
133
I've seen some debate about this before, but to my understanding, hashing twice with SHA256d was originally a security measure back when Bitcoin was still in its early days, particularly to prevent pre-calculated attacks on the network, making it a more secure choice. Single SHA256 may still be secure in this regard, but it's more a matter of being cautious with a security measure that's already in place rather than getting rid of it all together.
 
Top