...
Source file
src/crypto/sha1/sha1block_amd64.go
1
2
3
4
5 package sha1
6
7 import "internal/cpu"
8
9
10 func blockAVX2(dig *digest, p []byte)
11
12
13 func blockAMD64(dig *digest, p []byte)
14
15 var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2
16
17 func block(dig *digest, p []byte) {
18 if useAVX2 && len(p) >= 256 {
19
20
21
22
23
24
25 safeLen := len(p) - 128
26 if safeLen%128 != 0 {
27 safeLen -= 64
28 }
29 blockAVX2(dig, p[:safeLen])
30 blockAMD64(dig, p[safeLen:])
31 } else {
32 blockAMD64(dig, p)
33 }
34 }
35
View as plain text