Module: Braintree::SHA256Digest

Defined in:
lib/braintree/sha256_digest.rb

Class Method Summary collapse

Class Method Details

._hmac(key, message) ⇒ Object



7
8
9
10
11
# File 'lib/braintree/sha256_digest.rb', line 7

def self._hmac(key, message)
  key_digest = ::Digest::SHA256.digest(key)
  sha256 = OpenSSL::Digest.new("sha256")
  OpenSSL::HMAC.hexdigest(sha256, key_digest, message.to_s)
end

.hexdigest(private_key, string) ⇒ Object



3
4
5
# File 'lib/braintree/sha256_digest.rb', line 3

def self.hexdigest(private_key, string)
  _hmac(private_key, string)
end