Skip to content

Instantly share code, notes, and snippets.

@geetfun
Created October 28, 2018 01:27
Show Gist options
  • Save geetfun/8c76727e854f866a9fd64a8fc0fdc56b to your computer and use it in GitHub Desktop.
Save geetfun/8c76727e854f866a9fd64a8fc0fdc56b to your computer and use it in GitHub Desktop.
Generate hmac comparison
calculated_hmac = Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', SHARED_SECRET, data))
ActiveSupport::SecurityUtils.secure_compare(calculated_hmac, hmac_header)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment