aboutsummaryrefslogtreecommitdiff
path: root/internal/adler32/adler32_fallback.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/adler32/adler32_fallback.go')
-rw-r--r--internal/adler32/adler32_fallback.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/adler32/adler32_fallback.go b/internal/adler32/adler32_fallback.go
new file mode 100644
index 00000000..c213c3c1
--- /dev/null
+++ b/internal/adler32/adler32_fallback.go
@@ -0,0 +1,19 @@
+//go:build (!arm64 && !amd64) || purego
+
+package adler32
+
+import (
+ "hash"
+ "hash/adler32"
+)
+
+// The size of an Adler-32 checksum in bytes.
+const Size = 4
+
+// New returns a new hash.Hash32 computing the Adler-32 checksum.
+func New() hash.Hash32 {
+ return adler32.New()
+}
+
+// Checksum returns the Adler-32 checksum of data.
+func Checksum(data []byte) uint32 { return adler32.Checksum(data) }