class AdyenHppHmacCalculator::HmacCalculator
Constants
- DIGEST
Public Class Methods
new(hmac_key)
click to toggle source
# File lib/adyen_hpp_hmac_calculator/hmac_calculator.rb, line 6 def initialize hmac_key @hmac_key_hex = string_to_hex hmac_key end
Public Instance Methods
calculate(string)
click to toggle source
Calculates HMAC SHA-256 from string
@param string [String] string to calculate HMAC SHA-256 @return [String] HMAC SHA-256 string
# File lib/adyen_hpp_hmac_calculator/hmac_calculator.rb, line 14 def calculate string OpenSSL::HMAC.digest(DIGEST, @hmac_key_hex, string) end
Private Instance Methods
string_to_hex(string)
click to toggle source
# File lib/adyen_hpp_hmac_calculator/hmac_calculator.rb, line 20 def string_to_hex string Array(string).pack('H*') end