From b1fe11c6c9ae79bd8714ba7e627cff1665198fd4 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 15 Apr 2012 16:32:19 +0200 Subject: Use S-SHA1 by default. --- fripost-mkpass | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'fripost-mkpass') diff --git a/fripost-mkpass b/fripost-mkpass index c6a261b..c30bd37 100755 --- a/fripost-mkpass +++ b/fripost-mkpass @@ -6,7 +6,16 @@ use strict; =head1 NAME -fripost-mkpass - Create a random new password +fripost-mkpass - Create a random new password, and returns its hash + +=head1 SYNOPSIS + +B [I] + +=head1 DESCRIPTION + +Use I if given, otherwise generate a random new password, and +print both the clear copy and a salted SHA-1 hash. =cut @@ -15,30 +24,37 @@ use lib "$Bin/lib"; our $VERSION = '0.01'; +use Getopt::Long qw /:config noauto_abbrev no_ignore_case + gnu_compat bundling permute nogetopt_compat + auto_version auto_help/; +use Pod::Usage; use Fripost::Password; -use String::MkPasswd qw/mkpasswd/; + +GetOptions( "man" => sub { pod2usage(-exitstatus => 0, + -verbose => 2) } + ) or pod2usage(2); # Generate password my $password = $ARGV[0]; +$password //= mkpasswd(); -$password //= mkpasswd( - -length => 20, - -minnum => 5, - -minspecial => 3 -); # Show the information that will be inserted -say "Password: $password"; -say "Salted MD5: " . smd5($password); +say "Password: " . $password; +say "Salted SHA-1: " . hash(SHA1, undef, $password); -=head1 AUTHOR +=head1 AUTHORS Stefan Kangas C<< >> +Guilhem Moulin C<< >> + =head1 COPYRIGHT Copyright 2010,2011 Stefan Kangas. +Copyright 2012 Guilhem Moulin. + =head1 LICENSE This program is free software; you can redistribute it and/or modify it -- cgit v1.2.3