Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created April 23, 2017 09:56
Show Gist options
  • Save anonymous/d9cc734b9ed527b60347a27f7465998b to your computer and use it in GitHub Desktop.
Save anonymous/d9cc734b9ed527b60347a27f7465998b to your computer and use it in GitHub Desktop.
winning_number = SecureRandom.random_number(0..36).to_s
digest = OpenSSL::Digest.new('sha256')
secret_key = SecureRandom.urlsafe_base64(nil, false)
hash = OpenSSL::HMAC.hexdigest(digest, secret_key, winning_number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment