mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-10-13 12:34:10 -04:00
common.Must2
This commit is contained in:
@@ -4,15 +4,16 @@ import (
|
||||
"crypto/md5"
|
||||
"hash/fnv"
|
||||
|
||||
"golang.org/x/crypto/sha3"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/serial"
|
||||
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
// Authenticate authenticates a byte array using Fnv hash.
|
||||
func Authenticate(b []byte) uint32 {
|
||||
fnv1hash := fnv.New32a()
|
||||
fnv1hash.Write(b)
|
||||
common.Must2(fnv1hash.Write(b))
|
||||
return fnv1hash.Sum32()
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ type ShakeSizeParser struct {
|
||||
|
||||
func NewShakeSizeParser(nonce []byte) *ShakeSizeParser {
|
||||
shake := sha3.NewShake128()
|
||||
shake.Write(nonce)
|
||||
common.Must2(shake.Write(nonce))
|
||||
return &ShakeSizeParser{
|
||||
shake: shake,
|
||||
}
|
||||
@@ -92,7 +93,7 @@ func (*ShakeSizeParser) SizeBytes() int {
|
||||
}
|
||||
|
||||
func (s *ShakeSizeParser) next() uint16 {
|
||||
s.shake.Read(s.buffer[:])
|
||||
common.Must2(s.shake.Read(s.buffer[:]))
|
||||
return serial.BytesToUint16(s.buffer[:])
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user