lib/braintree/digest.rb in braintree-1.0.1 vs lib/braintree/digest.rb in braintree-1.1.0

- old
+ new

@@ -4,17 +4,11 @@ _hmac_sha1(Configuration.private_key, string) end def self._hmac_sha1(key, message) key_digest = ::Digest::SHA1.digest(key) - inner_padding = "\x36" * 64 - outer_padding = "\x5c" * 64 - 0.upto(19) do |i| - inner_padding[i] ^= key_digest[i] - outer_padding[i] ^= key_digest[i] - end - inner_hash = ::Digest::SHA1.digest(inner_padding + message.to_s) - ::Digest::SHA1.hexdigest(outer_padding + inner_hash) + sha1 = OpenSSL::Digest::Digest.new("sha1") + OpenSSL::HMAC.hexdigest(sha1, key_digest, message.to_s) end end end