Skip to content

Instantly share code, notes, and snippets.

@toadkicker
Forked from yorzi/api_key_generator.rb
Created March 18, 2013 17:46
Show Gist options
  • Save toadkicker/5189213 to your computer and use it in GitHub Desktop.
Save toadkicker/5189213 to your computer and use it in GitHub Desktop.
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