Skip to content

Instantly share code, notes, and snippets.

@dkam
Created March 26, 2012 05:19
Show Gist options
  • Save dkam/2203157 to your computer and use it in GitHub Desktop.
Save dkam/2203157 to your computer and use it in GitHub Desktop.
Calculate a signature
def calculate_sig(data, key)
digest = OpenSSL::Digest::Digest.new('sha1')
res = OpenSSL::HMAC.digest(digest, key, data)
sig = [res].pack('m').chomp
return sig
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment