<oembed><type>rich</type><version>1.0</version><author_name>npub1ac86vemj7ce5z8jyxt39rna3tvwql6xd30ha3vxcd6esysp23d9qrlswfj</author_name><author_url>https://nostr.ae/npub1ac86vemj7ce5z8jyxt39rna3tvwql6xd30ha3vxcd6esysp23d9qrlswfj</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2016-01-08&#xA;📝 Original message:Tricky choice. On the one hand I had spotted this too before and maybe&#xA;one or two more exceptions to bitcoin&#39;s 128-bit security target and&#xA;been vaguely tut-tutting about them in the background.  It&#39;s kind of a&#xA;violation of crypto rule of thumb that you want to balance things and&#xA;not have odd weak points as Watson was implying, it puts you closer to&#xA;the margin if there is a slip or other problem so you have an&#xA;imbalanced crypto format.&#xA;&#xA;On the other hand it&#39;s not currently a problem as such and it&#39;s less&#xA;change and slightly more compact.&#xA;&#xA;RIPEMD probably is less well reviewed than SHA2.  However SHA1 has&#xA;problems, and SHA2 is a bigger SHA1 basically so, hence the NIST&#xA;motivation for SHA3 designed to fix the design flaw in SHA1 (and SHA2&#xA;in principle).&#xA;&#xA;So then if we agree with this rule of thumb (and not doing so would&#xA;fly against best practices which we probably shouldnt look to do in&#xA;such a security focussed domain) then what this discussion is more&#xA;about is when is a good time to write down tech debt.&#xA;&#xA;I think that comes to segregated-witness itself which writes down a&#xA;tidily organised by lines of code robust fix to a bunch of long&#xA;standing problems.&#xA;&#xA;Doing a 2MB hard-fork in comparison fixes nothing really.  Leaving&#xA;known issues to bake in for another N years eventually builds up on&#xA;you (not even in security just in software engineering) as another&#xA;rule of thumb.  I mean if we dont fix it now that we are making a&#xA;change that connects, when will we?&#xA;&#xA;In software projects I ran we always disguised the cost of tech-debt&#xA;as non-negotiable baked into our estimates without a line item to&#xA;escape the PHB syndrome of haggling for features instead of tech debt&#xA;(which is _never_ a good idea:)&#xA;&#xA;Pragmatism vs refactoring as you go.&#xA;&#xA;But for scale I think segregated-witness does offer the intriguing&#xA;next step of being able to do 2 of 2, 3 of 3 and N of N which give&#xA;size of one sig multisig (indistinguishable even for privacy) as well&#xA;as K of N key tree sigs, which are also significantly more compact.&#xA;&#xA;There was also the other thing I mentioned further up the thread that&#xA;if we want to take an approach of living with little bit of bloat from&#xA;getting back to a universal 128-bit target, there are still some&#xA;fixable bloat things going on:&#xA;a) sending pubKey in the signature vs recovery (modulo interference&#xA;with Schnorr batch verify compatibility*);&#xA;b) using the PubKey instead of PKH in the ScriptPubKey, though that&#xA;loses the nice property of of not having the key to do DL attacks on&#xA;until the signed transaction is broadcast;&#xA;c) I think there might be a way to combine hash &amp; PubKey to keep the&#xA;delayed PubKey publication property and yet still save the bloat of&#xA;having both.&#xA;&#xA;* I did suggest to Pieter that you could let the miner decide to forgo&#xA;Schnorr batch verifiability to get compaction from recovery - the pub&#xA;key could be optionally elided from the scriptSig serialisation by the&#xA;miner.&#xA;&#xA;The other thing we could consider is variable sized hashes (&amp; a few&#xA;pubkey size choices) that is software complexity however.  We might be&#xA;better of focussing on the bigger picture like IBLT/weak-blocks and&#xA;bigger wins like MAST, multiSig Schnorr &amp; key tree sigs.&#xA;&#xA;Didnt get time to muse on c) but a nice crypto question for someone :)&#xA;&#xA;Another thing to note is combining has been known to be fragile to bad&#xA;interactions or unexpected behaviours.  This paper talks about things&#xA;tradeoffs and weaknesses in hash combiners.&#xA;http://tuprints.ulb.tu-darmstadt.de/2094/1/thesis.lehmann.pdf&#xA;&#xA;Weak concept NACK I think for losing a cleanup opportunity to store it&#xA;up for the future when there is a reasonable opportunity to fix it?&#xA;&#xA;Adam&#xA;&#xA;&#xA;On 8 January 2016 at 15:34, Watson Ladd via bitcoin-dev&#xA;&lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt; On Fri, Jan 8, 2016 at 4:38 AM, Gavin Andresen via bitcoin-dev&#xA;&gt; &lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt;&gt; On Fri, Jan 8, 2016 at 7:02 AM, Rusty Russell &lt;rusty at rustcorp.com.au&gt; wrote:&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; Matt Corallo &lt;lf-lists at mattcorallo.com&gt; writes:&#xA;&gt;&gt;&gt; &gt; Indeed, anything which uses P2SH is obviously vulnerable if there is&#xA;&gt;&gt;&gt; &gt; an attack on RIPEMD160 which reduces it&#39;s security only marginally.&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; I don&#39;t think this is true?  Even if you can generate a collision in&#xA;&gt;&gt;&gt; RIPEMD160, that doesn&#39;t help you since you need to create a specific&#xA;&gt;&gt;&gt; SHA256 hash for the RIPEMD160 preimage.&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; Even a preimage attack only helps if it leads to more than one preimage&#xA;&gt;&gt;&gt; fairly cheaply; that would make grinding out the SHA256 preimage easier.&#xA;&gt;&gt;&gt; AFAICT even MD4 isn&#39;t this broken.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; It feels like we&#39;ve gone over that before, but I can never remember where or&#xA;&gt;&gt; when. I believe consensus was that if we were using the broken MD5 in all&#xA;&gt;&gt; the places we use RIPEMD160 we&#39;d still be secure today because of Satoshi&#39;s&#xA;&gt;&gt; use of nested hash functions everywhere.&#xA;&gt;&gt;&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; But just with Moore&#39;s law (doubling every 18 months), we&#39;ll worry about&#xA;&gt;&gt;&gt; economically viable attacks in 20 years.[1]&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; That&#39;s far enough away that I would choose simplicity, and have all SW&#xA;&gt;&gt;&gt; scriptPubKeys simply be &#34;&lt;0&gt; RIPEMD(SHA256(WP))&#34; for now, but it&#39;s&#xA;&gt;&gt;&gt; not a no-brainer.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; Lets see if I&#39;ve followed the specifics of the collision attack correctly,&#xA;&gt;&gt; Ethan (or somebody) please let me know if I&#39;m missing something:&#xA;&gt;&gt;&#xA;&gt;&gt; So attacker is in the middle of establishing a payment channel with&#xA;&gt;&gt; somebody. Victim gives their public key, attacker creates the innocent&#xA;&gt;&gt; fund-locking script  &#39;2 V A 2 CHECKMULTISIG&#39; (V is victim&#39;s public key, A is&#xA;&gt;&gt; attacker&#39;s) but doesn&#39;t give it to the victim yet.&#xA;&gt;&gt;&#xA;&gt;&gt; Instead they then generate about 2^81scripts that are some form of&#xA;&gt;&gt; pay-to-attacker ....&#xA;&gt;&gt; ... wait, no that doesn&#39;t work, because SHA256 is used as the inner hash&#xA;&gt;&gt; function.  They&#39;d have to generate 2^129 to find a cycle in SHA256.&#xA;&gt;&#xA;&gt; For 2^80 they simply generate 2^80 scripts that look innocent, and&#xA;&gt; 2^80 that are not. With high probability there is a collision. I agree&#xA;&gt; that most cryptanalysis won&#39;t work because of the nesting, but 2^80 is&#xA;&gt; not good.&#xA;&gt;&gt;&#xA;&gt;&gt; Instead, they .. what? I don&#39;t see a viable attack unless RIPEMD160 and&#xA;&gt;&gt; SHA256 (or the combination) suffers a cryptographic break.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; --&#xA;&gt;&gt; --&#xA;&gt;&gt; Gavin Andresen&#xA;&gt;&gt;&#xA;&gt;&gt; _______________________________________________&#xA;&gt;&gt; bitcoin-dev mailing list&#xA;&gt;&gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt;&gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; --&#xA;&gt; &#34;Man is born free, but everywhere he is in chains&#34;.&#xA;&gt; --Rousseau.&#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</html></oembed>