aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Commands/mkpass.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Fripost/Commands/mkpass.pm')
-rw-r--r--lib/Fripost/Commands/mkpass.pm59
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/Fripost/Commands/mkpass.pm b/lib/Fripost/Commands/mkpass.pm
new file mode 100644
index 0000000..0ac2570
--- /dev/null
+++ b/lib/Fripost/Commands/mkpass.pm
@@ -0,0 +1,59 @@
+package Fripost::Commands::mkpass;
+
+use 5.010_000;
+use warnings;
+use strict;
+use utf8;
+
+=head1 NAME
+
+mkpass.pm - Create a random new password, and returns its hash
+
+=cut
+
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+use Fripost::Password;
+
+our $VERSION = '0.01';
+
+our @EXPORT = qw/main/;
+our @ISA = qw(Exporter);
+
+sub main {
+ my $password = shift;
+ $password //= mkpasswd();
+
+ # Show the information that will be inserted
+ say "Password: " . $password;
+ say "Salted SHA-1: " . hash($password, SHA1, undef);
+}
+
+
+=head1 AUTHORS
+
+Stefan Kangas C<< <skangas at skangas.se> >>
+
+Guilhem Moulin C<< <guilhem at fripost.org> >>
+
+=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
+under the same terms as perl itself.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+=cut
+
+1; # End of mkpass.pm
+
+__END__
+