Skip to content

Instantly share code, notes, and snippets.

@jasonsilberman
Forked from bentonporter/gist:2891463
Created October 28, 2014 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonsilberman/add7c3a55ec433543552 to your computer and use it in GitHub Desktop.
Save jasonsilberman/add7c3a55ec433543552 to your computer and use it in GitHub Desktop.
require 'openssl'
require 'Base64'
key = "secret-key"
data = "some data to be signed"
Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, data)).strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment