]> Sergey Matveev's repositories - meta4ra.git/blobdiff - internal/xxh3.go
*-hashes-detect, *-hash, *-check -stdin/-all-hashes, optional builtins
[meta4ra.git] / internal / xxh3.go
diff --git a/internal/xxh3.go b/internal/xxh3.go
new file mode 100644 (file)
index 0000000..6f3f9d8
--- /dev/null
@@ -0,0 +1,26 @@
+//go:build thirdparty
+
+package internal
+
+import (
+       "hash"
+
+       "github.com/zeebo/xxh3"
+)
+
+type XXH3128 struct {
+       *xxh3.Hasher
+}
+
+func (x XXH3128) Size() int {
+       return 16
+}
+
+func (x XXH3128) Sum(b []byte) []byte {
+       tmp := x.Hasher.Sum128().Bytes()
+       return append(b, tmp[:]...)
+}
+
+func NewXXH3128() hash.Hash {
+       return &XXH3128{xxh3.New()}
+}