Skip to content

Instantly share code, notes, and snippets.

View andrewleo's full-sized avatar
🎯
Focusing

Liu Xiao andrewleo

🎯
Focusing
  • Netease
  • Hangzhou, Zhejiang, China
View GitHub Profile
@bentonporter
bentonporter / gist:2891463
Created June 7, 2012 20:51
Ruby - HMAC-SHA256 example
require 'openssl'
require 'Base64'
key = "secret-key"
data = "some data to be signed"
Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), key, data)).strip()