diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-11-10 13:42:39 -0800 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-11-10 13:42:39 -0800 |
commit | d1a46e16129cc7139a773ec146ac31e24548e6b8 (patch) | |
tree | f527a023e4db1831a83b3122d88f8e6a263aedb2 /lib/mixlib/authentication/digester.rb | |
parent | da05c14ab9456aa0af803aecb2b606060fbf38e3 (diff) | |
download | mixlib-authentication-d1a46e16129cc7139a773ec146ac31e24548e6b8.tar.gz |
Allow passing in the digest type to digester
It was assuming SHA1, we're going to want to be able to pass
in other values
Diffstat (limited to 'lib/mixlib/authentication/digester.rb')
-rw-r--r-- | lib/mixlib/authentication/digester.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/mixlib/authentication/digester.rb b/lib/mixlib/authentication/digester.rb index 7dc6dd7..071e5a7 100644 --- a/lib/mixlib/authentication/digester.rb +++ b/lib/mixlib/authentication/digester.rb @@ -21,11 +21,10 @@ require 'mixlib/authentication' module Mixlib module Authentication class Digester - class << self - - def hash_file(f) - digester = Digest::SHA1.new + + def hash_file(digest, f) + digester = digest.new buf = "" while f.read(16384, buf) digester.update buf @@ -34,15 +33,15 @@ module Mixlib end # Digests a string, base64's and chomps the end - # + # # ====Parameters - # - def hash_string(str) - ::Base64.encode64(Digest::SHA1.digest(str)).chomp + # + def hash_string(digest, str) + ::Base64.encode64(digest.digest(str)).chomp end - + end - + end end end |