change hash for udp connection id to xxhash3

* update dependencies
This commit is contained in:
Lawrence, Rendall
2022-11-21 14:25:48 +03:00
parent ef6d820c5b
commit ae0c006cd2
3 changed files with 14 additions and 8 deletions
+4 -2
View File
@@ -7,7 +7,7 @@ import (
"net/netip"
"time"
"github.com/minio/sha256-simd"
"github.com/zeebo/xxh3"
"github.com/sot-tech/mochi/pkg/log"
)
@@ -41,7 +41,9 @@ type ConnectionIDGenerator struct {
// NewConnectionIDGenerator creates a new connection ID generator.
func NewConnectionIDGenerator(key string) *ConnectionIDGenerator {
return &ConnectionIDGenerator{
mac: hmac.New(sha256.New, []byte(key)),
mac: hmac.New(func() hash.Hash {
return xxh3.New()
}, []byte(key)),
connID: make([]byte, 8),
scratch: make([]byte, 32),
}