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
You need to create an account or log in to post comments to this site.
11381 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
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
You need to create an account or log in to post comments to this site.