Class: Itsdangerousr::HMACAlgorithm

Inherits:
SigningAlgorithm show all
Defined in:
lib/itsdangerousr.rb

Instance Method Summary collapse

Methods inherited from SigningAlgorithm

#verify_signature

Constructor Details

#initialize(digest_method = OpenSSL::Digest::SHA1) ⇒ HMACAlgorithm

Returns a new instance of HMACAlgorithm.



41
42
43
# File 'lib/itsdangerousr.rb', line 41

def initialize(digest_method=OpenSSL::Digest::SHA1)
  @digest_method = digest_method
end

Instance Method Details

#get_signature(key, value) ⇒ Object



45
46
47
# File 'lib/itsdangerousr.rb', line 45

def get_signature(key, value)
  OpenSSL::HMAC.digest(@digest_method.new, key, value)
end