Skip to content

Instantly share code, notes, and snippets.

@rupakg
Last active September 24, 2015 03:28
Show Gist options
  • Save rupakg/660831 to your computer and use it in GitHub Desktop.
Save rupakg/660831 to your computer and use it in GitHub Desktop.
SHA1
require 'hmac-sha1'
require 'digest/sha1'
require 'base64'
token="-Sat, 14 Nov 2009 09:47:53 GMT-GET-/video.xml-"
private_key="whatever"
salt=Digest::SHA1.hexdigest(token)[0..19]
passkey=Base64.encode64(HMAC::SHA1.digest(private_key, salt)).strip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment