aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ecookie.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/ecookie.go b/ecookie.go
index 23927df..41e60f7 100644
--- a/ecookie.go
+++ b/ecookie.go
@@ -3,6 +3,7 @@ package ecookie
import (
"bytes"
"crypto/rand"
+ "crypto/subtle"
"encoding/hex"
"errors"
"io"
@@ -114,7 +115,8 @@ func (h *Decryptor) Decrypt(raw []byte) ([]byte, error) {
return nil, err
}
- if !bytes.Equal(cl, u[:lenhashfnc]) {
+ eq := subtle.ConstantTimeCompare(cl, u[:lenhashfnc])
+ if eq != 1 {
return nil, ErrAUTHCOK
}

Snix LLC Git Repository Holder Copyright(C) 2022 All Rights Reserved Email To Snix.IR