diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-10-30 13:56:27 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-10-30 13:56:27 -0600 |
commit | 76c22c7b388d659530a4f6d0ae9f242827f7ed82 (patch) | |
tree | a320d8878e97712fd23a952a3daa232f9d27100e /modules/caddyhttp/caddyauth/hashes.go | |
parent | c7da6175bc654a37510541d6d55b7a0010cfd210 (diff) |
auth: Clean up basicauth
Diffstat (limited to 'modules/caddyhttp/caddyauth/hashes.go')
-rw-r--r-- | modules/caddyhttp/caddyauth/hashes.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/caddyhttp/caddyauth/hashes.go b/modules/caddyhttp/caddyauth/hashes.go index a515c09..13010db 100644 --- a/modules/caddyhttp/caddyauth/hashes.go +++ b/modules/caddyhttp/caddyauth/hashes.go @@ -15,6 +15,8 @@ package caddyauth import ( + "crypto/subtle" + "github.com/caddyserver/caddy/v2" "golang.org/x/crypto/bcrypt" "golang.org/x/crypto/scrypt" @@ -103,6 +105,10 @@ func (s ScryptHash) Compare(hashed, plaintext, salt []byte) (bool, error) { return false, nil } +func hashesMatch(pwdHash1, pwdHash2 []byte) bool { + return subtle.ConstantTimeCompare(pwdHash1, pwdHash2) == 1 +} + // Interface guards var ( _ Comparer = (*BcryptHash)(nil) |