Advertisement
paperline27

create-pw.rb

Jan 18th, 2024
1,145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.24 KB | Cybersecurity | 0 0
  1. chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + ['!', '@', '#', '$', '%', '^', '&', '*']
  2.  
  3. puts "panjang password: "
  4. length = gets.chomp.to_i
  5.  
  6. password = Array.new(length) { chars.sample }.join
  7.  
  8. puts "Password: #{password}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement