Skip to content

Instantly share code, notes, and snippets.

@Lytol
Created November 13, 2008 20:39
Show Gist options
  • Save Lytol/24613 to your computer and use it in GitHub Desktop.
Save Lytol/24613 to your computer and use it in GitHub Desktop.
require 'digest/sha1'
module SecureToken
def self.secure_digest(*args)
Digest::SHA1.hexdigest(args.flatten.join('--'))
end
def self.generate_token
secure_digest(Time.now, (1..10).map{ rand.to_s })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment