Skip to content

Instantly share code, notes, and snippets.

@petemcw
Created April 27, 2011 15:16
Show Gist options
  • Save petemcw/944434 to your computer and use it in GitHub Desktop.
Save petemcw/944434 to your computer and use it in GitHub Desktop.
Random Key Generator
class KeyGenerator
require "digest/sha1"
def self.generate(length = 12)
Digest::SHA1.hexdigest(Time.now.to_s + rand(567891234).to_s)[1..length]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment