]>
git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - bin/generate_password
8 puts
"generate_password <size> <seed_file> <password_key>"
12 size
= arguments
.shift
13 seed_file
= arguments
.shift
14 password_key
= arguments
.shift
18 set
= ('a' .. 'z').to_a +
('A' .. 'Z').to_a +
('0' .. '9').to_a
20 key
= "#{File.open(seed_file).read}:#{password_key}"
22 password
= size
.times
.collect
do |i
|
23 set
[OpenSSL
::HMAC.hexdigest(OpenSSL
::Digest.new('sha256'), key
, i
.to_s
).to_i(16) % set
.size
]