# Gavin Andresen # 2012-10-27 19:14:12 # https://bitcointalk.org/index.php?topic=120473.msg1301958#msg1301958 @s{quotedtext} @s{quotedtext} @p{brk} I think that is a good thought experiment: If you replaced all uses of SHA256 in Bitcoin with MD5, what attacks would be possible? (please check my work, I am not an expert on hash collisions) @p{par} Well, to @p{(link}generate a collision@p{link)}: @p{brk} @s{quotedtext} @s{quotedtext} @p{brk} Block hashing would be safe, for now; the block header that is hashed is only 80 bytes long, much less than the 128 bytes of wiggle room needed to find a collision. @p{par} I believe an attacker could easily produce two different non-standard transactions that hashed to the same txid. That would be a disaster, they could split the blockchain and/or double-spend by broadcasting one version of the transaction to half the network and the other to the other half of the network. @p{par} To split the chain the attacker would mine a block containing the 'poison' transaction hash, and then broadcast two versions of the same block, containing the two different-but-same-hash transactions. Half the network would think that block contains 't1', and half 't2'. Everything would be just fine until the attacker spent the outputs of t1 and/or t2... then Bad Things would happen. @p{par} Double-hashing doesn't help at all: If HASH(t1) == HASH(t2) then HASH(HASH(t1)) == HASH(HASH(t2)) @p{par} @p{hrule} I do agree with everybody who points out that SHA256 isn't close to being broken. If it does ever start to get close, then I'm sure we could figure out a backwards-compatible fixes and phase them in (something like "a block's coinbase transaction must include a SHA3-based transaction merkle root", create a new version of OP_CHECKSIG that used SHA3, roll out a new alert system that used SHA3, etc). @p{par} @p{brk}