Class: Mixlib::Authentication::Digester
- Inherits:
-
Object
- Object
- Mixlib::Authentication::Digester
- Defined in:
- lib/mixlib/authentication/digester.rb
Class Method Summary collapse
- .hash_file(f, digest = OpenSSL::Digest::SHA1) ⇒ Object
-
.hash_string(str, digest = OpenSSL::Digest::SHA1) ⇒ Object
Digests a string, base64’s and chomps the end.
Class Method Details
.hash_file(f, digest = OpenSSL::Digest::SHA1) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/mixlib/authentication/digester.rb', line 27 def hash_file(f, digest = OpenSSL::Digest::SHA1) digester = digest.new buf = "" digester.update buf while f.read(16384, buf) ::Base64.encode64(digester.digest).chomp end |
.hash_string(str, digest = OpenSSL::Digest::SHA1) ⇒ Object
Digests a string, base64’s and chomps the end
Parameters
38 39 40 |
# File 'lib/mixlib/authentication/digester.rb', line 38 def hash_string(str, digest = OpenSSL::Digest::SHA1) ::Base64.encode64(digest.digest(str)).chomp end |