Module: RestCore::Hmac
- Defined in:
- lib/rest-core/util/hmac.rb
Class Method Summary (collapse)
- + (Object) sha1(key, data)
-
+ (Object) sha256(key, data)
Fallback to ruby-hmac gem in case system openssl lib doesn't support SHA256 (OSX 10.5).
Class Method Details
+ (Object) sha1(key, data)
16 17 18 19 20 21 |
# File 'lib/rest-core/util/hmac.rb', line 16 def sha1 key, data OpenSSL::HMAC.digest('sha1', key, data) rescue RuntimeError require 'hmac-sha1' HMAC::SHA1.digest(key, data) end |
+ (Object) sha256(key, data)
Fallback to ruby-hmac gem in case system openssl lib doesn't support SHA256 (OSX 10.5)
9 10 11 12 13 14 |
# File 'lib/rest-core/util/hmac.rb', line 9 def sha256 key, data OpenSSL::HMAC.digest('sha256', key, data) rescue RuntimeError require 'hmac-sha2' HMAC::SHA256.digest(key, data) end |