<oembed><type>rich</type><version>1.0</version><author_name>npub1e46n428mcyfwznl7nlsf6d3s7rhlwm9x3cmkuqzt3emmdpadmkaqqjxmcu</author_name><author_url>https://nostr.ae/npub1e46n428mcyfwznl7nlsf6d3s7rhlwm9x3cmkuqzt3emmdpadmkaqqjxmcu</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2016-01-07&#xA;📝 Original message:We absolutely should be worried about 80-bit collision resistance.&#xA;Collisions only take 2**80 work if the hash is theoretically perfect,&#xA;which is never the case, not to mention that collision resistance is&#xA;almost always the first thing to go for hash functions, and often starts&#xA;to get easier slowly long, long before anyone is truly worried about the&#xA;security of the hash function.&#xA;&#xA;I would never assume RIPEMD160&#39;s collision resistance is 2**80, and&#xA;would definitely never wager a significant amount of money that this&#xA;remains true for, say, five years.&#xA;&#xA;Matt&#xA;&#xA;On 01/07/16 19:02, Gavin Andresen via bitcoin-dev wrote:&#xA;&gt; I&#39;m hoisting this from some private feedback I sent on the segregated&#xA;&gt; witness BIP:&#xA;&gt; &#xA;&gt; I said:&#xA;&gt; &#xA;&gt; &#34;I&#39;d also use RIPEMD160(SHA256()) as the hash function and save the 12&#xA;&gt; bytes-- a successful preimage attack against that ain&#39;t gonna happen&#xA;&gt; before we&#39;re all dead. I&#39;m probably being dense, but I just don&#39;t see&#xA;&gt; how a collision attack is relevant here.&#34;&#xA;&gt; &#xA;&gt; Pieter responded:&#xA;&gt; &#xA;&gt; &#34;The problem case is where someone in a contract setup shows you a&#xA;&gt; script, which you accept as being a payment to yourself. An attacker&#xA;&gt; could use a collision attack to construct scripts with identical hashes,&#xA;&gt; only one of which does have the property you want, and steal coins.&#xA;&gt; &#xA;&gt; So you really want collision security, and I don&#39;t think 80 bits is&#xA;&gt; something we should encourage for that. Normal pubkey hashes don&#39;t have&#xA;&gt; that problem, as they can&#39;t be constructed to pay to you.&#34;&#xA;&gt; &#xA;&gt; ... but I&#39;m unconvinced:&#xA;&gt; &#xA;&gt; &#34;But it is trivial for contract wallets to protect against collision&#xA;&gt; attacks-- if you give me a script that is &#34;gavin_pubkey CHECKSIG&#xA;&gt; arbitrary_data OP_DROP&#34; with &#34;I promise I&#39;m not trying to rip you off,&#xA;&gt; just ignore that arbitrary data&#34; a wallet can just refuse. Even more&#xA;&gt; likely, a contract wallet won&#39;t even recognize that as a pay-to-gavin&#xA;&gt; transaction.&#xA;&gt; &#xA;&gt; I suppose it could be looking for some form of &#34;gavin_pubkey&#xA;&gt; somebody_else_pubkey CHECKMULTISIG ... with the attacker using&#xA;&gt; somebody_else_pubkey to force the collision, but, again, trivial&#xA;&gt; contract protocol tweaks (&#34;send along a proof you have the private key&#xA;&gt; corresponding to the public key&#34; or &#34;everybody pre-commits pubkeys&#xA;&gt; they&#39;ll use at protocol start&#34;) would protect against that.&#xA;&gt; &#xA;&gt; Adding an extra 12 bytes to every segwit to prevent an attack that takes&#xA;&gt; 2^80 computation and 2^80 storage, is unlikely to be a problem in&#xA;&gt; practice, and is trivial to protect against is the wrong tradeoff to make.&#34;&#xA;&gt; &#xA;&gt; 20 bytes instead of 32 bytes is a savings of almost 40%, which is&#xA;&gt; significant.&#xA;&gt; &#xA;&gt; The general question I&#39;d like to raise on this list is:&#xA;&gt; &#xA;&gt; Should we be worried, today, about collision attacks against RIPEMD160&#xA;&gt; (our 160-bit hash)?&#xA;&gt; &#xA;&gt; Mounting a successful brute-force collision attack would require at&#xA;&gt; least O(2^80) CPU, which is kinda-sorta feasible (Pieter pointed out&#xA;&gt; that Bitcoin POW has computed more SHA256 hashes than that). But it also&#xA;&gt; requires O(2^80) storage, which is utterly infeasible (there is&#xA;&gt; something on the order of 2^35 bytes of storage in the entire world). &#xA;&gt; Even assuming doubling every single year (faster than Moore&#39;s Law),&#xA;&gt; we&#39;re four decades away from an attacker with THE ENTIRE WORLD&#39;s storage&#xA;&gt; capacity being able to mount a collision attack.&#xA;&gt; &#xA;&gt; &#xA;&gt; References: &#xA;&gt; &#xA;&gt; https://en.wikipedia.org/wiki/Collision_attack&#xA;&gt; &#xA;&gt; https://vsatglobalseriesblog.wordpress.com/2013/06/21/in-2013-the-amount-of-data-generated-worldwide-will-reach-four-zettabytes/&#xA;&gt; &#xA;&gt; &#xA;&gt; -- &#xA;&gt; --&#xA;&gt; Gavin Andresen&#xA;&gt; &#xA;&gt; &#xA;&gt; &#xA;&gt; _______________________________________________&#xA;&gt; bitcoin-dev mailing list&#xA;&gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#xA;&gt;</html></oembed>