summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-06-27 19:24:22 -0400
committerGitHub <noreply@github.com>2019-06-27 19:24:22 -0400
commit6eda04886e3a57918ca2d6a482fda02a678fef0a (patch)
tree914608ca4f59c0d0929914c41153120bc3ffd98c
parentdda1537e91cd0db14c7cf3207df923adaca48f33 (diff)
parentabad221e43c21e0fa2cadc38ae0504e62b45186f (diff)
downloadrack-6eda04886e3a57918ca2d6a482fda02a678fef0a.tar.gz
Merge pull request #1371 from krzysiek1507/refactor/auth-digest-md5
Reduce memory usage in Rack::Auth::Digest::MD5 methods
-rw-r--r--lib/rack/auth/digest/md5.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/rack/auth/digest/md5.rb b/lib/rack/auth/digest/md5.rb
index ec6d8748..62bff984 100644
--- a/lib/rack/auth/digest/md5.rb
+++ b/lib/rack/auth/digest/md5.rb
@@ -108,21 +108,21 @@ module Rack
alias :H :md5
def KD(secret, data)
- H([secret, data] * ':')
+ H "#{secret}:#{data}"
end
def A1(auth, password)
- [ auth.username, auth.realm, password ] * ':'
+ "#{auth.username}:#{auth.realm}:#{password}"
end
def A2(auth)
- [ auth.method, auth.uri ] * ':'
+ "#{auth.method}:#{auth.uri}"
end
def digest(auth, password)
password_hash = passwords_hashed? ? password : H(A1(auth, password))
- KD(password_hash, [ auth.nonce, auth.nc, auth.cnonce, QOP, H(A2(auth)) ] * ':')
+ KD password_hash, "#{auth.nonce}:#{auth.nc}:#{auth.cnonce}:#{QOP}:#{H A2(auth)}"
end
end