<oembed><type>rich</type><version>1.0</version><author_name>npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_name><author_url>https://nostr.ae/npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2016-01-08&#xA;📝 Original message:On Fri, Jan 08, 2016 at 07:38:50AM -0500, Gavin Andresen via bitcoin-dev wrote:&#xA;&gt; Lets see if I&#39;ve followed the specifics of the collision attack correctly,&#xA;&gt; Ethan (or somebody) please let me know if I&#39;m missing something:&#xA;&gt; &#xA;&gt; So attacker is in the middle of establishing a payment channel with&#xA;&gt; somebody. Victim gives their public key, attacker creates the innocent&#xA;&gt; fund-locking script  &#39;2 V A 2 CHECKMULTISIG&#39; (V is victim&#39;s public key, A&#xA;&gt; is attacker&#39;s) but doesn&#39;t give it to the victim yet.&#xA;&#xA;Using Ethan Heilman&#39;s procedure, the attacker can create two scripts:&#xA;&#xA;  2 V __A1__ 2 CHECKMULTISIG&#xA;&#xA;  2 V __A2__ 2 CHECKMULTISIG&#xA;&#xA;and find values A1 and A2 which hash the scripts to the same result&#xA;with under 3*2**80 work. I think you can do that by setting the next&#xA;private key as the result of RIPEMD(SHA256(script with pubkey)), so you&#xA;could still spend either. But it doesn&#39;t change the script, so it&#39;s not&#xA;*that* helpful -- you&#39;ve just got two different keys you can use.&#xA;&#xA;Ah, but you can make the form of the script be a function of your key, so:&#xA;&#xA;  if privkey % 2 == 0:&#xA;    script = &#34;2 V %s 2 CHECKMULTISIG&#34; % (pubkey)&#xA;  else:&#xA;    script = &#34;%s CHECKSIG&#34; % (pubkey)&#xA;  hash = ripemd160(sha256(script))&#xA;&#xA;  nextprivkey = hash&#xA;&#xA;Then you have a 50% chance of your cycle giving you a matching hash for&#xA;one script with A1 and the other script with A2, and you can find the&#xA;cycle with under 3*2**80 work. Doing five attempts should give you ~96%&#xA;chance of hitting a usable pair, and should take under 15*2**80 work ~=&#xA;2**84 work, with trivial memory use.&#xA;&#xA;Trying that in python with a vastly weakened hash function (namely,&#xA;the first five bytes of ripemd160(sha256()), with 40 bits of security&#xA;and 3*2**20 work) works as expected -- I got a &#34;useful&#34; collision on my&#xA;second try in about 7 seconds, seeding with &#34;grumpycat3&#34; (&#34;grumpycat2&#34;&#xA;didn&#39;t work) with the result being:&#xA;&#xA; hexlify(ripemd160(sha256(&#34;foo%sbar&#34;%unhexlify(&#34;86f9fbac1a&#34;)))[:5])&#xA; &#39;ae94d9f908&#39;&#xA;&#xA; hexlify(ripemd160(sha256(&#34;baz%squux&#34;%unhexlify(&#34;104fc5093f&#34;)))[:5])&#xA; &#39;ae94d9f908&#39;&#xA;&#xA;Cheers,&#xA;aj</html></oembed>