<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-07&#xA;📝 Original message:You could say 256 bit ECDSA is overkill lets go to 160 equivalently.&#xA;Saves even more bytes.&#xA;&#xA;The problem with arguing down is where to stop.&#xA;&#xA;As Matt said these things dont degrade gracefully so a best practice&#xA;is to aim for a bit of extra margin.&#xA;&#xA;256-bit is quite common at this point since AES, SHA256 etc even in&#xA;things with much less at stake than Bitcoin.&#xA;&#xA;You could send the compressed (unhashed) pubkey then there&#39;s no hash&#xA;(and omit it from the sig).  Greg had mentioned that in the past.&#xA;&#xA;I think it might be possible to do both (reclaim the hash bits in the&#xA;serialisation of the pub key).&#xA;&#xA;Adam&#xA;&#xA;On 7 January 2016 at 20:02, Gavin Andresen via bitcoin-dev&#xA;&lt;bitcoin-dev at lists.linuxfoundation.org&gt; 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 before&#xA;&gt; we&#39;re all dead. I&#39;m probably being dense, but I just don&#39;t see how a&#xA;&gt; 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 script,&#xA;&gt; which you accept as being a payment to yourself. An attacker could use a&#xA;&gt; collision attack to construct scripts with identical hashes, only one of&#xA;&gt; 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 that&#xA;&gt; 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, just&#xA;&gt; ignore that arbitrary data&#34; a wallet can just refuse. Even more likely, a&#xA;&gt; contract wallet won&#39;t even recognize that as a pay-to-gavin 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 contract&#xA;&gt; protocol tweaks (&#34;send along a proof you have the private key corresponding&#xA;&gt; to the public key&#34; or &#34;everybody pre-commits pubkeys they&#39;ll use at protocol&#xA;&gt; 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 practice,&#xA;&gt; 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 (our&#xA;&gt; 160-bit hash)?&#xA;&gt;&#xA;&gt; Mounting a successful brute-force collision attack would require at least&#xA;&gt; O(2^80) CPU, which is kinda-sorta feasible (Pieter pointed out that Bitcoin&#xA;&gt; POW has computed more SHA256 hashes than that). But it also requires O(2^80)&#xA;&gt; storage, which is utterly infeasible (there is something on the order of&#xA;&gt; 2^35 bytes of storage in the entire world).  Even assuming doubling every&#xA;&gt; single year (faster than Moore&#39;s Law), we&#39;re four decades away from an&#xA;&gt; attacker with THE ENTIRE WORLD&#39;s storage capacity being able to mount a&#xA;&gt; 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; 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>