Type:
Class

digest/hmac.rb

An experimental implementation of HMAC keyed-hashing algorithm

Overview

CAUTION: Use of this library is discouraged, because this implementation was meant to be experimental but somehow got into the 1.9 series without being noticed. Please use OpenSSL::HMAC in the “openssl” library instead.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'digest/hmac'
 
# one-liner example
puts Digest::HMAC.hexdigest("data", "hash key", Digest::SHA1)
 
# rather longer one
hmac = Digest::HMAC.new("foo", Digest::RMD160)
 
buf = ""
while stream.read(16384, buf)
  hmac.update(buf)
end
 
puts hmac.bubblebabble
<<
  • References/Ruby on Rails/Ruby/Classes/Digest/Digest::HMAC

<<(text) Instance Public methods Alias for:

2025-01-10 15:47:30
reset
  • References/Ruby on Rails/Ruby/Classes/Digest/Digest::HMAC

hmac.reset â hmac Instance Public methods Resets the hmac to the initial state

2025-01-10 15:47:30
inspect
  • References/Ruby on Rails/Ruby/Classes/Digest/Digest::HMAC

hmac.inspect â string Instance Public methods Creates a printable version of

2025-01-10 15:47:30
block_length
  • References/Ruby on Rails/Ruby/Classes/Digest/Digest::HMAC

hmac.block_length â Integer Instance Public methods Returns the block length

2025-01-10 15:47:30
update
  • References/Ruby on Rails/Ruby/Classes/Digest/Digest::HMAC

hmac.update(string) â hmachmac Instance Public methods

2025-01-10 15:47:30
digest_length
  • References/Ruby on Rails/Ruby/Classes/Digest/Digest::HMAC

hmac.digest_length â Integer Instance Public methods Returns the length in

2025-01-10 15:47:30
new
  • References/Ruby on Rails/Ruby/Classes/Digest/Digest::HMAC

new(key, digester) Class Public methods Creates a

2025-01-10 15:47:30