lib/gibberish/hmac.rb in gibberish-0.0.2 vs lib/gibberish/hmac.rb in gibberish-1.0.0
- old
+ new
@@ -1,5 +1,13 @@
module Gibberish
+ # Easy to use HMAC, defaults to SHA1
+ #
+ # ## Example
+ #
+ # Gibberish::HMAC('key', 'data') #=> 104152c5bfdca07bc633eebd46199f0255c9f49d
+ # Gibberish::HMAC('key', 'data', :digest => :sha256)
+ # #=> 5031fe3d989c6d1537a013fa6e739da23463fdaec3b70137d828e36ace221bd0
+ #
class HMAC
DIGEST = {
:sha1 => OpenSSL::Digest::Digest.new('sha1'),
:sha256 => OpenSSL::Digest::Digest.new('sha256')
}