Working with Digests and Signatures

###MD5 digests### MD5 is a one-way hashing algorithm for creating digest “signatures” or checksums of strings. MD5 digests are 128 bit (16 byte) signatures. MD5 is the most common method of providing checksums for files downloaded over the internet. To create a checksum of an entire file or text convert the whole string.

digest = Digest::MD5.hexdigest(string_to_digest)

source link

###hmac-sha1###

In cryptography, a hash-based message authentication code (HMAC) is a specific construction for calculating a message authentication code (MAC) involving a cryptographic hash function in combination with a secret cryptographic key. As with any MAC, it may be used to simultaneously verify both the data integrity and the authenticity of a message.

source link

In ruby its simple to generate one:

gem install ruby-hmac

def hmac_sha1 params={}
  require 'openssl'
  secret_key = 'No telling a secret'
  OpenSSL::HMAC.hexdigest('sha1', secret_key, params)
end

Any questions on this, please feel free to ask. We’re here to help…