{"type":"rich","version":"1.0","author_name":"npub1gaszwl7qd0tjmnwcaamgzzgsmzzjlvle6kz0td66pwa8z69vsxsqxgac47","author_url":"https://nostr.ae/npub1gaszwl7qd0tjmnwcaamgzzgsmzzjlvle6kz0td66pwa8z69vsxsqxgac47","provider_name":"njump","provider_url":"https://nostr.ae","html":"📅 Original date posted:2016-01-07\n📝 Original message:Based on current GH/s count of 775,464,121 Bitcoin tests 2^80 every 19 days.\nlog2(775464121*(1000*1000*1000*60*60*24*19)) = ~80.07\n\nI don't fully understand the security model of segwit, so my analysis\nwill assume that any collision is bad.\n\n\u003eBut it also requires O(2^80) storage, which is utterly infeasible\n\nYou don't store all 2^80 previous hashes, instead you just hash a seed\nvalue 2^80 times, then look for a cycle.\n\nseed = {0,1}^160\nx = hash(seed)\n\nfor i in 2^80:\n....x = hash(x)\nx_final = x\n\ny = hash(x_final)\n\nfor j in 2^80:\n....if y == x_final:\n........print \"cycle len: \"+j\n........break\n....y = hash(y)\n\nIf at any point x collides with a prior value of x it will form a\ncycle. Thus y will also cycle and collide with x_final. j gives you\nthe cycle length, which allows you find the collision:\nhash^(2^80-j)(seed) == hash^(j)(hash^(2^80-j)(seed)).\n\nWorst case:\nFirst loop costs 2**80, second loop costs 2**80=j, finding the\ncolliding value is 2**80. Total cost 2**80+2**80+2**80 = 2**81.5 and\nrequires storing less than a kilobyte.\n\nThis is a toy example, does not exploit parallelism, time memory trade\noffs, can be easily made better, etc...\n\nOn Thu, Jan 7, 2016 at 2:02 PM, Gavin Andresen via bitcoin-dev\n\u003cbitcoin-dev at lists.linuxfoundation.org\u003e wrote:\n\u003e I'm hoisting this from some private feedback I sent on the segregated\n\u003e witness BIP:\n\u003e\n\u003e I said:\n\u003e\n\u003e \"I'd also use RIPEMD160(SHA256()) as the hash function and save the 12\n\u003e bytes-- a successful preimage attack against that ain't gonna happen before\n\u003e we're all dead. I'm probably being dense, but I just don't see how a\n\u003e collision attack is relevant here.\"\n\u003e\n\u003e Pieter responded:\n\u003e\n\u003e \"The problem case is where someone in a contract setup shows you a script,\n\u003e which you accept as being a payment to yourself. An attacker could use a\n\u003e collision attack to construct scripts with identical hashes, only one of\n\u003e which does have the property you want, and steal coins.\n\u003e\n\u003e So you really want collision security, and I don't think 80 bits is\n\u003e something we should encourage for that. Normal pubkey hashes don't have that\n\u003e problem, as they can't be constructed to pay to you.\"\n\u003e\n\u003e ... but I'm unconvinced:\n\u003e\n\u003e \"But it is trivial for contract wallets to protect against collision\n\u003e attacks-- if you give me a script that is \"gavin_pubkey CHECKSIG\n\u003e arbitrary_data OP_DROP\" with \"I promise I'm not trying to rip you off, just\n\u003e ignore that arbitrary data\" a wallet can just refuse. Even more likely, a\n\u003e contract wallet won't even recognize that as a pay-to-gavin transaction.\n\u003e\n\u003e I suppose it could be looking for some form of \"gavin_pubkey\n\u003e somebody_else_pubkey CHECKMULTISIG ... with the attacker using\n\u003e somebody_else_pubkey to force the collision, but, again, trivial contract\n\u003e protocol tweaks (\"send along a proof you have the private key corresponding\n\u003e to the public key\" or \"everybody pre-commits pubkeys they'll use at protocol\n\u003e start\") would protect against that.\n\u003e\n\u003e Adding an extra 12 bytes to every segwit to prevent an attack that takes\n\u003e 2^80 computation and 2^80 storage, is unlikely to be a problem in practice,\n\u003e and is trivial to protect against is the wrong tradeoff to make.\"\n\u003e\n\u003e 20 bytes instead of 32 bytes is a savings of almost 40%, which is\n\u003e significant.\n\u003e\n\u003e The general question I'd like to raise on this list is:\n\u003e\n\u003e Should we be worried, today, about collision attacks against RIPEMD160 (our\n\u003e 160-bit hash)?\n\u003e\n\u003e Mounting a successful brute-force collision attack would require at least\n\u003e O(2^80) CPU, which is kinda-sorta feasible (Pieter pointed out that Bitcoin\n\u003e POW has computed more SHA256 hashes than that). But it also requires O(2^80)\n\u003e storage, which is utterly infeasible (there is something on the order of\n\u003e 2^35 bytes of storage in the entire world).  Even assuming doubling every\n\u003e single year (faster than Moore's Law), we're four decades away from an\n\u003e attacker with THE ENTIRE WORLD's storage capacity being able to mount a\n\u003e collision attack.\n\u003e\n\u003e\n\u003e References:\n\u003e\n\u003e https://en.wikipedia.org/wiki/Collision_attack\n\u003e\n\u003e https://vsatglobalseriesblog.wordpress.com/2013/06/21/in-2013-the-amount-of-data-generated-worldwide-will-reach-four-zettabytes/\n\u003e\n\u003e\n\u003e --\n\u003e --\n\u003e Gavin Andresen\n\u003e\n\u003e\n\u003e _______________________________________________\n\u003e bitcoin-dev mailing list\n\u003e bitcoin-dev at lists.linuxfoundation.org\n\u003e https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev\n\u003e"}
