File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -24,5 +24,9 @@ build-arm64:
2424 docker build -t sha1cd-arm64 -f Dockerfile.arm64 .
2525 docker run --rm sha1cd-arm64
2626
27+ # Build with cgo disabled.
28+ build-nocgo :
29+ CGO_ENABLED=0 go build ./cgo
30+
2731# Run cross-compilation to assure supported architectures.
28- cross-build : build-arm build-arm64
32+ cross-build : build-arm build-arm64 build-nocgo
Original file line number Diff line number Diff line change 1+ //go:build !cgo
2+ // +build !cgo
3+
4+ package cgo
5+
6+ import (
7+ "hash"
8+
9+ "github.com/pjbgf/sha1cd"
10+ "github.com/pjbgf/sha1cd/ubc"
11+ )
12+
13+ // CalculateDvMask falls back to github.com/pjbgf/sha1cd/ubc implementation
14+ // due to CGO being disabled at compilation time.
15+ func CalculateDvMask (W []uint32 ) (uint32 , error ) {
16+ return ubc .CalculateDvMask (W )
17+ }
18+
19+ // CalculateDvMask falls back to github.com/pjbgf/sha1cd implementation
20+ // due to CGO being disabled at compilation time.
21+ func New () hash.Hash {
22+ return sha1cd .New ()
23+ }
24+
25+ // CalculateDvMask falls back to github.com/pjbgf/sha1cd implementation
26+ // due to CGO being disabled at compilation time.
27+ func Sum (data []byte ) ([]byte , bool ) {
28+ d := sha1cd .New ().(sha1cd.CollisionResistantHash )
29+ d .Write (data )
30+
31+ return d .CollisionResistantSum (nil )
32+ }
You can’t perform that action at this time.
0 commit comments