mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 19:23:34 +01:00
chore: modernize CI and update Go toolchain
- Bump Go from 1.19 to 1.26 and update all dependencies - Rewrite CI workflow with matrix strategy (Linux, macOS, Windows) - Update GitHub Actions to current versions (checkout@v4, setup-go@v5) - Update CodeQL actions from v1 to v3 - Fix cross-platform bug in mock/path.go (path.Join -> filepath.Join) - Clean up dependabot config (weekly schedule, remove stale ignore) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
44
vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.go
generated
vendored
44
vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.go
generated
vendored
@@ -1,48 +1,50 @@
|
||||
//go:build !noasm && gc && amd64
|
||||
// +build !noasm,gc,amd64
|
||||
//go:build !noasm && gc && amd64 && !arm64
|
||||
// +build !noasm,gc,amd64,!arm64
|
||||
|
||||
package sha1cd
|
||||
|
||||
import (
|
||||
"math"
|
||||
"unsafe"
|
||||
"runtime"
|
||||
|
||||
"github.com/klauspost/cpuid/v2"
|
||||
shared "github.com/pjbgf/sha1cd/internal"
|
||||
)
|
||||
|
||||
type sliceHeader struct {
|
||||
base uintptr
|
||||
len int
|
||||
cap int
|
||||
}
|
||||
var hasSHANI = (runtime.GOARCH == "amd64" &&
|
||||
cpuid.CPU.Supports(cpuid.AVX) &&
|
||||
cpuid.CPU.Supports(cpuid.SHA) &&
|
||||
cpuid.CPU.Supports(cpuid.SSE3) &&
|
||||
cpuid.CPU.Supports(cpuid.SSE4))
|
||||
|
||||
// blockAMD64 hashes the message p into the current state in dig.
|
||||
// blockAMD64 hashes the message p into the current state in h.
|
||||
// Both m1 and cs are used to store intermediate results which are used by the collision detection logic.
|
||||
//
|
||||
//go:noescape
|
||||
func blockAMD64(dig *digest, p sliceHeader, m1 []uint32, cs [][5]uint32)
|
||||
func blockAMD64(h []uint32, p []byte, m1 []uint32, cs [][5]uint32)
|
||||
|
||||
func block(dig *digest, p []byte) {
|
||||
if forceGeneric || !hasSHANI {
|
||||
blockGeneric(dig, p)
|
||||
return
|
||||
}
|
||||
|
||||
m1 := [shared.Rounds]uint32{}
|
||||
cs := [shared.PreStepState][shared.WordBuffers]uint32{}
|
||||
|
||||
for len(p) >= shared.Chunk {
|
||||
// Only send a block to be processed, as the collission detection
|
||||
// works on a block by block basis.
|
||||
ips := sliceHeader{
|
||||
base: uintptr(unsafe.Pointer(&p[0])),
|
||||
len: int(math.Min(float64(len(p)), float64(shared.Chunk))),
|
||||
cap: shared.Chunk,
|
||||
}
|
||||
// The assembly code only supports processing a block at a time,
|
||||
// so adjust the chunk accordingly.
|
||||
chunk := p[:shared.Chunk]
|
||||
|
||||
blockAMD64(dig, ips, m1[:], cs[:])
|
||||
blockAMD64(dig.h[:], chunk, m1[:], cs[:])
|
||||
rectifyCompressionState(m1, &cs)
|
||||
|
||||
col := checkCollision(m1, cs, dig.h)
|
||||
if col {
|
||||
dig.col = true
|
||||
|
||||
blockAMD64(dig, ips, m1[:], cs[:])
|
||||
blockAMD64(dig, ips, m1[:], cs[:])
|
||||
blockAMD64(dig.h[:], chunk, m1[:], cs[:])
|
||||
blockAMD64(dig.h[:], chunk, m1[:], cs[:])
|
||||
}
|
||||
|
||||
p = p[shared.Chunk:]
|
||||
|
||||
Reference in New Issue
Block a user