From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15910 invoked from network); 1 Jun 2021 12:52:22 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 1 Jun 2021 12:52:22 -0000 Received: from duke.felloff.net ([216.126.196.34]) by 1ess; Tue Jun 1 08:47:08 -0400 2021 Message-ID: <1C4DE32C373501A487F0F5F1AD185B49@felloff.net> Date: Tue, 01 Jun 2021 14:46:58 +0200 From: cinap_lenrek@felloff.net To: 9front@9front.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: distributed content-addressed cloud JSON over WEB2.0 map/reduce deep-learning hypervisor blockchain controller Subject: Re: [9front] [PATCH] sha3 but fixed the code style Reply-To: 9front@9front.org Precedence: bulk where is sha3_keccakf.c? -.I SHA2_512dlen +.I SHA2_512dlen, why not: -.I SHA2_512dlen +.IR SHA2_512dlen , -- sha3() leaks DigestDstate. suggested change: ... sha3_keccakf(s->bstate); memmove(digest, s->b, dlen); if(s->alloced) free(s); return nil; -- + j = s->pt; + for (i = 0; i < len; i++) { + s->b[j++] ^= p[i]; + if (j >= s->blen) { + sha3_keccakf(s->bstate); + j = 0; + } + } + s->pt = j; doing the xor byte-by-byte sucks. -- union { - u32int state[16]; - u64int bstate[8]; + uchar b[200]; + u32int state[50]; + u64int bstate[25]; }; i do not like b[200] aliasing bstate here. i think it would be better to handle this explicitely in the code. -- cinap