Skip to content
Snippets Groups Projects
Commit 6d1a314b authored by Francois Bernier's avatar Francois Bernier
Browse files

Use OpenSSL::Digest instead of deprecated OpenSSL::Digest::Digest

parent a78ea8f1
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ module Geocoder::Lookup ...@@ -31,7 +31,7 @@ module Geocoder::Lookup
def sign(string) def sign(string)
raw_private_key = url_safe_base64_decode(configuration.api_key[0]) raw_private_key = url_safe_base64_decode(configuration.api_key[0])
digest = OpenSSL::Digest::Digest.new('sha1') digest = OpenSSL::Digest.new('sha1')
raw_signature = OpenSSL::HMAC.digest(digest, raw_private_key, string) raw_signature = OpenSSL::HMAC.digest(digest, raw_private_key, string)
url_safe_base64_encode(raw_signature) url_safe_base64_encode(raw_signature)
end end
......
...@@ -49,7 +49,7 @@ class OauthUtil ...@@ -49,7 +49,7 @@ class OauthUtil
key = percent_encode( @consumer_secret ) + '&' + percent_encode( @token_secret ) key = percent_encode( @consumer_secret ) + '&' + percent_encode( @token_secret )
# ref: http://blog.nathanielbibler.com/post/63031273/openssl-hmac-vs-ruby-hmac-benchmarks # ref: http://blog.nathanielbibler.com/post/63031273/openssl-hmac-vs-ruby-hmac-benchmarks
digest = OpenSSL::Digest::Digest.new( 'sha1' ) digest = OpenSSL::Digest.new( 'sha1' )
hmac = OpenSSL::HMAC.digest( digest, key, @base_str ) hmac = OpenSSL::HMAC.digest( digest, key, @base_str )
# ref http://groups.google.com/group/oauth-ruby/browse_thread/thread/9110ed8c8f3cae81 # ref http://groups.google.com/group/oauth-ruby/browse_thread/thread/9110ed8c8f3cae81
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment