]> Sergey Matveev's repositories - meta4ra.git/blob - internal/xxh3.go
6f3f9d8d798f9e38ed5ce06aeb734f50c16d634f
[meta4ra.git] / internal / xxh3.go
1 //go:build thirdparty
2
3 package internal
4
5 import (
6         "hash"
7
8         "github.com/zeebo/xxh3"
9 )
10
11 type XXH3128 struct {
12         *xxh3.Hasher
13 }
14
15 func (x XXH3128) Size() int {
16         return 16
17 }
18
19 func (x XXH3128) Sum(b []byte) []byte {
20         tmp := x.Hasher.Sum128().Bytes()
21         return append(b, tmp[:]...)
22 }
23
24 func NewXXH3128() hash.Hash {
25         return &XXH3128{xxh3.New()}
26 }