From: nishi Date: Mon, 15 Apr 2024 02:35:16 +0000 (+0000) Subject: password generator X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=dbfa8e5cf65dc029f23a958e1cb15dafe541ac4b;p=mandshurica.git password generator git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@25 f982e544-4a7d-3444-ad1a-fde59a2a69f1 --- diff --git a/mkpasswd.pl b/mkpasswd.pl new file mode 100644 index 0000000..e284ecb --- /dev/null +++ b/mkpasswd.pl @@ -0,0 +1,33 @@ +# $Id$ + +use Digest::SHA qw(sha256 sha256_hex); +require Term::ReadKey; + +if(@ARGV < 1) { + print "Pass me username\n"; + exit 1 +} + +print "Password: "; + +Term::ReadKey::ReadMode("noecho"); + +my $password = Term::ReadKey::ReadLine(0); + +print "\n"; +print "Verify Password: "; + +my $verify = Term::ReadKey::ReadLine(0); + +print "\n"; + +if ($password eq $verify) { + my $digest = sha256_hex($password); + + print "$ARGV[0]:$digest\n"; +} else { + print "Unmatched\n"; + exit 1 +} + +Term::ReadKey::ReadMode("restore");