Skip to content

Instantly share code, notes, and snippets.

@jasonbuck
Created June 25, 2011 18:28
Show Gist options
  • Save jasonbuck/1046745 to your computer and use it in GitHub Desktop.
Save jasonbuck/1046745 to your computer and use it in GitHub Desktop.
Random key generator
class KeyGenerator
require "digest/sha1"
def self.generate(length = 10)
Digest::SHA1.hexdigest(Time.now.to_s + rand(12341234).to_s)[1..length]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment