How to create MD5 hash with HMAC module in Ruby?
This should be the easiest way:
OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('md5'), secret_key, your_data)
The following gem should be installed: 'ruby-hmac'
$ irb
>> require 'hmac-md5'
=> true
>> HMAC::MD5.new("abc").digest
=> "\324\035\214\331\217\000\262\004\351\200\t\230\354\370B~"
>> HMAC::MD5.new("abc").hexdigest
=> "d41d8cd98f00b204e9800998ecf8427e"
>>
This is what I did:
HMAC::MD5.new(shared_key).update(data).hexdigest