Monday, December 17, 2012

random password generator


#!/usr/bin/ruby -w
# random password generator

require 'securerandom'

puts "enter max number of char: "
chars = gets.chomp.to_i
newnum = rand(36 ** chars).to_s(36) #sub chars with max req length of password
puts "your new password is #{newnum}"
othernum = SecureRandom.urlsafe_base64(chars)
puts "...or if you want " + othernum

No comments:

Post a Comment