git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Linus' sha1 is much faster!

From
BDBryan Donlan <bdonlan@gmail.com>
Date
Aug 15, 2009, 20:02 UTC
Message-ID
<3e8340490908151302y33a97d50t38ad0a8a788f1cee@mail.gmail.com>
In-Reply-To
<4A85F270.20703@draigBrady.com>
2009/8/14 Pádraig Brady <P@draigbrady.com>:
Show 27 quoted lines
> I've noticed before that coreutils hashing utils
> were a little behind in performance, but was prompted
> to look at it again when I noticed the recently
> updated sha1 implementation in git:
> http://git.kernel.org/?p=git/git.git;a=history;f=block-sha1;h=d3121f7;hb=pu
>
> Testing that with the attached program which I wrote
> in a couple of mins to try and match sha1sum's system calls
> shows that it's around 33% faster, as shown below:
>
> $ gcc $(rpm -q --qf="%{OPTFLAGS}\n" coreutils) linus-sha1.c sha1.c -o linus-sha1
>
> $ time ./linus-sha1 300MB_file
> df1e19e245fee4f53087b50ef953ca2c8d1644d7  300MB_file
> real    0m2.742s
> user    0m2.516s
> sys     0m0.206s
>
> $ time ~/git/coreutils/src/sha1sum 300MB_file
> df1e19e245fee4f53087b50ef953ca2c8d1644d7  300MB_file
>
> real    0m4.166s
> user    0m3.846s
> sys     0m0.298s
>
> So, could we use that code in coreutils?
> Think of all the dead fish it would save.

coreutils is licensed under GPLv3, and git under GPLv2 (only), so you'd need permission from all contributors to the implementation in order to relicense under GPLv3. A quick grep of the history suggests these contributors to be:

Brandon Casey <drafnel@gmail.com> Junio C Hamano <gitster@pobox.com> Linus Torvalds <torvalds@linux-foundation.org> Nicolas Pitre <nico@cam.org> (adding these people to the CC list)

Additionally, it was originally based on the code in mozilla-sha1/sha1.c, but that contains a license grant allowing it to be used under GPLv2 /or later/, so if GPLv3 relicensing is enough it shouldn't be necessary to get in contact with the original author. However if the FSF requires copyright assignment to accept the new implementation, it will be necessary to track down contributors to the original mozilla-sha1/sha1.c as well.

Note that I'm not a lawyer, so there might be other roadblocks etc to this as well, etc :)

Previous: Pádraig BradyNext: John Tapsell
Message 2 of 21 in “Linus' sha1 is much faster!”
  1. Pádraig BradyAug 14, 2009
  2. Bryan DonlanAug 15, 2009
  3. John TapsellAug 15, 2009
  4. Linus TorvaldsAug 15, 2009
  5. Linus TorvaldsAug 15, 2009
  6. Nicolas PitreAug 17, 2009
  7. Pádraig BradyAug 26, 2009
  8. galtApr 20, 2017
  9. galtApr 20, 2017
  10. Andreas EricssonAug 17, 2009
  11. Theodore TsoAug 16, 2009
  12. Giuseppe ScrivanoAug 16, 2009
  13. Linus TorvaldsAug 16, 2009
  14. Giuseppe ScrivanoAug 16, 2009
  15. Linus TorvaldsAug 16, 2009
  16. Pádraig BradyAug 17, 2009
  17. Giuseppe ScrivanoAug 17, 2009
  18. Steven NoonanAug 17, 2009
  19. Linus TorvaldsAug 17, 2009
  20. Steven NoonanAug 17, 2009
  21. Giuseppe ScrivanoAug 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.