On Tue, Jul 05, 2022 at 11:05:18PM +0000, brian m. carlson wrote: > 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. > 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