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

Re: [PATCH] sha256: add support for Nettle

From
Jeff King <peff@peff.net>
Date
Jul 6, 2022, 08:23 UTC
Message-ID
<YsVGgFlxUbwtL6zn@coredump.intra.peff.net>
In-Reply-To
<20220705230518.713218-1-sandals@crustytoothpaste.net>
On Tue, Jul 05, 2022 at 11:05:18PM +0000, brian m. carlson wrote:
Show 6 quoted lines
> Let's add another option that's compatible with the GPLv2, which is
> Nettle.  It also has recently gained support for Intel's SHA-NI
> instructions, which compare very favorably to other implementations.
> For example, using this implementation and SHA-1 DC on a machine with
> SHA-NI, hashing a 2 GiB file with SHA-1 takes 7.582 seconds, while
> hashing the same file with SHA-256 takes 2.278 seconds.

Nifty. I was curious about the speed on my machine, since I still had that sha256 import of linux.git. Sadly, it's not nearly as impressive:

  [blk_sha256]
  $ time git index-pack --verify objects/pack/*.pack
  real	2m40.164s
  user	12m30.626s
  sys	0m31.567s
  [nettle]
  $ time git index-pack --verify objects/pack/*.pack
  real	2m21.346s
  user	10m14.507s
  sys	0m30.943s

which I take to mean that it doesn't support the Intel SHA extensions (and /proc/cpuinfo confirms that). Still, 12-18% speedup is a nice and easy win.

Show 5 quoted lines
>  Makefile        |  7 +++++++
>  hash.h          |  4 +++-
>  sha256/nettle.h | 28 ++++++++++++++++++++++++++++
>  3 files changed, 38 insertions(+), 1 deletion(-)
>  create mode 100644 sha256/nettle.h

The patch itself looks good to me, modulo the guard typo already pointed out.

-Peff
Previous: brian m. carlsonNext: Ævar Arnfjörð Bjarmason
Message 4 of 17 in “sha256: add support for Nettle”
  1. sha256: add support for Nettlebrian m. carlson, Jul 5, 2022
  2. Ramsay JonesJul 6, 2022
  3. brian m. carlsonJul 6, 2022
  4. Jeff KingJul 6, 2022
  5. Ævar Arnfjörð BjarmasonJul 6, 2022
  6. Jeff KingJul 6, 2022
  7. brian m. carlsonJul 6, 2022
  8. Junio C HamanoJul 6, 2022
  9. Junio C HamanoJul 6, 2022
  10. Junio C HamanoJul 7, 2022
  11. Junio C HamanoJul 7, 2022
  12. sha256: add support for Nettlebrian m. carlson, Jul 10, 2022
  13. Ævar Arnfjörð BjarmasonJul 10, 2022
  14. Junio C HamanoJul 10, 2022
  15. brian m. carlsonJul 10, 2022
  16. Junio C HamanoJul 10, 2022
  17. Reza MahdiAug 31, 2022

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.