Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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