annotate bin/pwgen @ 495:fea77cdcdb09

Size-customizable pwgen.
author edogawaconan <me@myconan.net>
date Fri, 20 Dec 2013 20:17:00 +0900
parents 8956a404dba6
children bdc9eddf3743
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
1 #!/usr/bin/env ruby
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
2
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
3 require 'securerandom'
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
4
495
fea77cdcdb09 Size-customizable pwgen.
edogawaconan <me@myconan.net>
parents: 478
diff changeset
5 length = ARGV[0].to_i
fea77cdcdb09 Size-customizable pwgen.
edogawaconan <me@myconan.net>
parents: 478
diff changeset
6 length = 12 if length <= 0
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
7 5.times do |n|
495
fea77cdcdb09 Size-customizable pwgen.
edogawaconan <me@myconan.net>
parents: 478
diff changeset
8 puts "#{n}: #{SecureRandom.urlsafe_base64(length).slice(0, length)}"
478
8956a404dba6 Added random password generator.
edogawaconan <me@myconan.net>
parents:
diff changeset
9 end