Re: [PATCH] Put sha1dc on a diet
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Mar 1, 2017, 18:49 UTC
- Message-ID
- <CA+55aFx1wAS-nHS2awuW2waX=cvig4UoZqmN5H3v93yDE7ukyQ@mail.gmail.com>
- In-Reply-To
- <xmqq7f48hm8g.fsf@gitster.mtv.corp.google.com>
On Wed, Mar 1, 2017 at 10:42 AM, Junio C Hamano <gitster@pobox.com> wrote:
> I see //c99 comments
sha1dc is already full of // style comments. I just followed the existing practice.
> and also T array[] = { [58] = val } both of
> which I think we stay away from (and the former is from the initial
> import), so some people on other platforms MAY have trouble with
> this topic.Hmm. The "{ [58] = val; }" kind of initialization would be easy to work around by just filling in everything else with NULL, but it would make for a pretty nasty readability issue.
That said, if you mis-count the NULL's, the end result will pretty immediately SIGSEGV, so I guess it wouldn't be much of a maintenance problem.
But if you're just willing to take the "let's see" approach, I think the explicitly numbered initializer is much better.
The main people who I assume would really want to use the sha1dc library are hosting places. And they won't be using crazy compilers from the last century.
That said, I think that it would be lovely to just default to USE_SHA1DC and just put the whole attack behind us. Yes, it's slower. No, it doesn't really seem to matter that much in practice.
Linus