From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9244A49F; Sat, 5 Oct 2019 15:49:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail148095.authsmtp.com (outmail148095.authsmtp.com [62.13.148.95]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E55E3709; Sat, 5 Oct 2019 15:49:08 +0000 (UTC) Received: from mail-c233.authsmtp.com (mail-c233.authsmtp.com [62.13.128.233]) by punt16.authsmtp.com. (8.15.2/8.15.2) with ESMTP id x95Fn73q059803; Sat, 5 Oct 2019 16:49:07 +0100 (BST) (envelope-from user@petertodd.org) Received: from petertodd.org (ec2-52-5-185-120.compute-1.amazonaws.com [52.5.185.120]) (authenticated bits=0) by mail.authsmtp.com (8.15.2/8.15.2) with ESMTPSA id x95Fn5p6026608 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 5 Oct 2019 16:49:06 +0100 (BST) (envelope-from user@petertodd.org) Received: from [127.0.0.1] (localhost [127.0.0.1]) by petertodd.org (Postfix) with ESMTPSA id A090340160; Sat, 5 Oct 2019 15:49:04 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 7516D1FF74; Sat, 5 Oct 2019 11:49:02 -0400 (EDT) Date: Sat, 5 Oct 2019 11:49:02 -0400 From: Peter Todd To: Jeremy Message-ID: <20191005154902.ck236q65xha25ore@petertodd.org> References: <87wodp7w9f.fsf@gmail.com> <20191001155929.e2yznsetqesx2jxo@erisian.com.au> <20191004111536.w7snbgpoe27xutfu@petertodd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="as5ahu4hs27l4qst" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Server-Quench: a9a5c4df-e787-11e9-8757-84349711df28 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd2Yg0TA1ZIVwkA IjsJECJaVQIpKltL GxAVKBZePFsRUQkR aQdMdgcUF1YAAgsB Am8bWlJeVFR7WWU7 bghPaBtcak9QXgdq T0pMXVMcXAxtd0IE RhgeUB90dw0IeX53 Y0csD3kKWRd+IRBg F0lcEnAHZDJpdWgY VUdFfwdXdApNfx4R PFJ3GhFYa3VsGiM3 HxM1PjY+eDlSNhEd cQsMMVkVQEBOEjMi clglJQIENHFNWCwo ZyYreBY3G0ANM0Mv MF0uEU4YPn1aBgxF FFxWGy5eIREITS02 EUtcWk8YCCBBCWAU Cxs5OgVFHDtPRkIA X-Authentic-SMTP: 61633532353630.1021:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 52.5.185.120/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Bitcoin Protocol Discussion , "lightning-dev@lists.linuxfoundation.org" Subject: Re: [bitcoin-dev] [Lightning-dev] OP_CAT was Re: Continuing the discussion about noinput / anyprevout X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Oct 2019 15:49:09 -0000 --as5ahu4hs27l4qst Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 04, 2019 at 11:40:53AM -0700, Jeremy wrote: > Interesting point. >=20 > The script is under your control, so you should be able to ensure that you > are always using a correctly constructed midstate, e.g., something like: >=20 > scriptPubKey: <-1> OP_SHA256STREAM DEPTH OP_SHA256STREAM <-2> > OP_SHA256STREAM > OP_EQUALVERIFY >=20 > would hash all the elements on the stack and compare to a known hash. > How is that sort of thing weak to midstateattacks? Obviously with care you can get the computation right. But at that point wh= at's the actual advantage over OP_CAT? We're limited by the size of the script anyway; if the OP_CAT output size l= imit is comparable to that for almost anything you could use SHA256STREAM on you could just as easily use OP_CAT, followed by a single OP_SHA256. --=20 https://petertodd.org 'peter'[:-1]@petertodd.org --as5ahu4hs27l4qst Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE0RcYcKRzsEwFZ3N5Lly11TVRLzcFAl2Yu2sACgkQLly11TVR Lzei4Q/7BHvAwCHYt0r98nFB2n/H2b9iBkbngtLlN6VF4wrUwJev0Adjsc1khlEY Y1/N4/lqOmvTowZClek2idz6YDPf+AoNR78SRl0JZcraZLfHCGd7MFO/0uVQxeyO vw9MLDzRBalIhJKT3PLL23PUJyULiLvWxblWWw2jdSWroxVJHi+CHH+5OfranJY6 KlHjjQPrwT3JW2mWmP2AwV3ZLROWX6Col4nHEIdSJivBFgP2FF2EDrkkLwU8Hgjf El6jCtYgFpdnu5dXplKLdmHeuCPGYUvWDO//dTtbTYaKcQkTyBeeH/QUHhELrspN S7+5XBpx3PB504zlDH52ROozbF3w/ZZrJ7Oz8hT3hjSuAavx/UP00cXEq6GAjJyQ 3AmYrgz8xx+v6Z02cjivnXWLZsrkkp2J2QGzRdNFrRR/Hnhtvjp7pEcTmkKkrOCJ wmvVO73bgcwD+jnWA73wRDqpvGmKt5bFsPBlpGNjsV8+kHMgKtHZ+oMeAyUKZ8DF DgV79difFbY2MElP2X/5mOKmNx/LvsG1fHmKOE6QzGjs3YprEcJUp5+F3jykXHK4 /mu2XPFunNA3cSNZFuW4BzcIzMwM5KtEWP6MzVWRVO3G2B6xBrdjp1Lmx60TqMbY gBtVi010JalC4K3Z43V2vPBXCid5Y2zUPSS/YwVOXDbDiqToSZQ= =Fr7x -----END PGP SIGNATURE----- --as5ahu4hs27l4qst--