<oembed><type>rich</type><version>1.0</version><author_name>npub1gaszwl7qd0tjmnwcaamgzzgsmzzjlvle6kz0td66pwa8z69vsxsqxgac47</author_name><author_url>https://nostr.ae/npub1gaszwl7qd0tjmnwcaamgzzgsmzzjlvle6kz0td66pwa8z69vsxsqxgac47</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2016-01-07&#xA;📝 Original message:&gt;Ethan:  your algorithm will find two arbitrary values that collide. That isn&#39;t useful as an attack in the context we&#39;re talking about here (both of those values will be useless as coin destinations with overwhelming probability).&#xA;&#xA;I&#39;m not sure exactly the properties you want here and determining&#xA;these properties is not an easy task, but the case is far worse than&#xA;just two random values. For instance: (a). with a small modification&#xA;my algorithm can also find collisions containing targeted substrings,&#xA;(b). length extension attacks are possible with RIPEMD160.&#xA;&#xA;(a). targeted cycles:&#xA;&#xA;target1 = &#34;str to prepend&#34;&#xA;target2 = &#34;str to end with&#34;&#xA;&#xA;seed = {0,1}^160&#xA;x = hash(seed)&#xA;&#xA;for i in 2^80:&#xA;....x = hash(target1||x||target2)&#xA;x_final = x&#xA;&#xA;y = hash(tartget1||x_final||target2)&#xA;&#xA;for j in 2^80:&#xA;....if y == x_final:&#xA;........print &#34;cycle len: &#34;+j&#xA;........break&#xA;....y = hash(target1||y||target2)&#xA;&#xA;If a collision is found, the two colliding inputs must both start with&#xA;&#34;str to prepend&#34; and end with the phrase &#34;str to end with&#34;. As before&#xA;this only requires 2^81.5 computations and no real memory. For an&#xA;additional 2**80 an adversary has an good change of finding two&#xA;different targeted substrings which collide. Consider the case where&#xA;the attacker mixes the targeted strings with the hash output:&#xA;&#xA;hash(&#34;my name is=0x329482039483204324423&#34;+x[1]+&#34;, my favorite number&#xA;is=&#34;+x) where x[1] is the first bit of x.&#xA;&#xA;(b). length extension attacks&#xA;&#xA;Even if all the adversary can do is create two random values that&#xA;collide, you can append substrings to the input and get collisions.&#xA;Once you find two random values hash(x) = hash(y), you could use a&#xA;length extension attack on RIPEMD-160 to find hash(x||z) = hash(y||z).&#xA;&#xA;Now the bitcoin wiki says:&#xA;&#34;The padding scheme is identical to MD4 using Merkle–Damgård&#xA;strengthening to prevent length extension attacks.&#34;[1]&#xA;&#xA;Which is confusing to me because:&#xA;&#xA;1. MD4 is vulnerable to length extension attacks&#xA;2. Merkle–Damgård strengthening does not protect against length&#xA;extension: &#34;Indeed, we already pointed out that none of the 64&#xA;variants above can withstand the &#39;extension&#39; attack on the MAC&#xA;application, even with the Merkle-Damgard strengthening&#34; [2]&#xA;3. RIPEMD-160 is vulnerable to length extension attacks, is Bitcoin&#xA;using a non-standard version of RIPEMD-160.&#xA;&#xA;RIPEMD160(SHA256()) does not protect against length extension attacks&#xA;on SHA256, but should protect RIPEMD-160 against length extension&#xA;attacks as RIPEMD-160 uses 512-bit message blocks. That being said we&#xA;should be very careful here. Research has been done that shows that&#xA;cascading the same hash function twice is weaker than using HMAC[3]. I&#xA;can&#39;t find results on cascading RIPEMD160(SHA256()).&#xA;&#xA;RIPEMD160(SHA256()) seems better than RIPEMD160() though, but security&#xA;should not rest on the notion that an attacker requires 2**80 memory,&#xA;many targeted collision attacks can work without much memory.&#xA;&#xA;[1]: https://en.bitcoin.it/wiki/RIPEMD-160&#xA;[2]: &#34;Merkle-Damgard Revisited: How to Construct a Hash Function&#34;&#xA;https://www.cs.nyu.edu/~puniya/papers/merkle.pdf&#xA;[3]: https://www.cs.nyu.edu/~dodis/ps/h-of-h.pdf&#xA;&#xA;On Thu, Jan 7, 2016 at 4:06 PM, Gavin Andresen via bitcoin-dev&#xA;&lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt; Maybe I&#39;m asking this question on the wrong mailing list:&#xA;&gt;&#xA;&gt; Matt/Adam: do you have some reason to think that RIPEMD160 will be broken&#xA;&gt; before SHA256?&#xA;&gt; And do you have some reason to think that they will be so broken that the&#xA;&gt; nested hash construction RIPEMD160(SHA256()) will be vulnerable?&#xA;&gt;&#xA;&gt; Adam: re: &#34;where to stop&#34;  :  I&#39;m suggesting we stop exactly at the current&#xA;&gt; status quo, where we use RIPEMD160 for P2SH and P2PKH.&#xA;&gt;&#xA;&gt; Ethan:  your algorithm will find two arbitrary values that collide. That&#xA;&gt; isn&#39;t useful as an attack in the context we&#39;re talking about here (both of&#xA;&gt; those values will be useless as coin destinations with overwhelming&#xA;&gt; probability).&#xA;&gt;&#xA;&gt; Dave: you described a first preimage attack, which is 2**160 cpu time and no&#xA;&gt; storage.&#xA;&gt;&#xA;&gt;&#xA;&gt; --&#xA;&gt; --&#xA;&gt; Gavin Andresen&#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>