Sha256: 65a0e99cb8d149ae9f76aec51e772a100858259a994f51a53ecd5221cbdd9af4
Contents?: true
Size: 647 Bytes
Versions: 5
Compression:
Stored size: 647 Bytes
Contents
module Ixtlan class Passwords def self.generate(length=64) # A-Z starting with 97 and having 26 characters # a-z starting with 65 and having 26 characters # 0-9 starting with 48 and lies inside range starting with 33 and having 26 characters offset=[97, 65, 33] # collect random characters from the either of the above ranges begin pwd = (0..(length - 1)).collect do j = ActiveSupport::SecureRandom.random_number(78) (offset[j / 26] + (j % 26)).chr end.join end while !((pwd =~ /[a-z]/) && (pwd =~ /[A-Z]/) && (pwd =~ /[!-;]/)) pwd end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ixtlan-0.2.4 | lib/ixtlan/passwords.rb |
ixtlan-0.2.3 | lib/ixtlan/passwords.rb |
ixtlan-0.2.2 | lib/ixtlan/passwords.rb |
ixtlan-0.2.1 | lib/ixtlan/passwords.rb |
ixtlan-0.2.0 | lib/ixtlan/passwords.rb |