From d8773d3e667317064f921c6fc6d840871797afc7 Mon Sep 17 00:00:00 2001 From: Matt Silverlock Date: Wed, 18 Mar 2015 07:06:26 +0800 Subject: Removed redundant calls to len() subtle.ConstantTimeCompare already undertakes a length check internally. --- securecookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/securecookie.go b/securecookie.go index 620c508..9218dc4 100644 --- a/securecookie.go +++ b/securecookie.go @@ -255,7 +255,7 @@ func createMac(h hash.Hash, value []byte) []byte { // verifyMac verifies that a message authentication code (MAC) is valid. func verifyMac(h hash.Hash, value []byte, mac []byte) error { mac2 := createMac(h, value) - if len(mac) == len(mac2) && subtle.ConstantTimeCompare(mac, mac2) == 1 { + if subtle.ConstantTimeCompare(mac, mac2) == 1 { return nil } return ErrMacInvalid -- cgit v1.2.3