aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-24 08:20:02 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-24 08:21:11 +0800
commit26ed38539645f18412e03a8613e3db4c6b0273c6 (patch)
tree3a556bcbacec29d2ce8c78198d559e94ed92abf2
parentidentifier.go, unsafe.go: Document unsafe usage (diff)
downloadpowxy-26ed38539645f18412e03a8613e3db4c6b0273c6.tar.gz
powxy-26ed38539645f18412e03a8613e3db4c6b0273c6.tar.zst
powxy-26ed38539645f18412e03a8613e3db4c6b0273c6.zip
identifier.go: Remove paranoid checks for buffer lengths
-rw-r--r--identifier.go6
1 files changed, 0 insertions, 6 deletions
diff --git a/identifier.go b/identifier.go
index a291f99..4b15f0f 100644
--- a/identifier.go
+++ b/identifier.go
@@ -30,16 +30,10 @@ func makeIdentifierMAC(request *http.Request) (identifier []byte, mac []byte) {
h.Write(stringToBytes(request.Header.Get("Accept-Language")))
h.Write(privkeyHash)
identifier = h.Sum(identifier)
- if len(identifier) != sha256.Size {
- panic("unexpected buffer length after hashing contents")
- }
m := hmac.New(sha256.New, privkey)
m.Write(identifier)
mac = m.Sum(mac)
- if len(mac) != sha256.Size {
- panic("unexpected buffer length after hmac")
- }
return
}