by jeromyj:

sha family hash functions on ARM architectures are quite slow, there is an
implementation of sha512 (and sha1) in libgcrypt that has assembly optimized code for
ARM Neon. It would be really nice to have something similar implemented into the Go
standard library.

Comment From: davecheney

Comment 1:

It would be great to have an assembly implementation of those crypto functions for arm.
There are two issues.
1. not all supported platforms support neon, so that means a non neon version would have
to be included and detected at runtime.
2. i am not a lawyer, and don't pretend to play one on tv, but the licence for libgcrypt
does not appear to be compatible with the Go licence.

Labels changed: added release-none, repo-main, arch-arm.

Status changed to Accepted.

Comment From: gopherbot

Comment 2 by jeromyj:

Couldnt the difference between neon code and code without be checked at compile time?
using a "*_neon.s" type file exension? Ive not looked too far into how the platform
specifiers work, so maybe thats not possible.

Comment From: minux

Comment 3:

subarch build tag has been proposed before, but rejected (?).
even if we can select code based on subarch, you might still want to two copies of the
code
to run systems without NEON.

Comment From: heisen-li

cryto/sha512: Will the assembly submitted to arm64 now be accepted?

Comment From: andig

@QiangHeisenberg I assume it will. There already are special cases in math/big for arm64 and sha256 has an arm64 implementation, too.

Comment From: andig

Related to https://go-review.googlesource.com/c/crypto/+/318869?

Comment From: splitice

And SHA256, its a bottleneck in docker pull generally (27% of a trace).

Comment From: xin3liang

Related to https://go-review.googlesource.com/c/go/+/667675 ?? And it is merged.