]> Nishi Git Mirror - mandshurica.git/commitdiff
password generator
authornishi <nishi@f982e544-4a7d-3444-ad1a-fde59a2a69f1>
Mon, 15 Apr 2024 02:35:16 +0000 (02:35 +0000)
committernishi <nishi@f982e544-4a7d-3444-ad1a-fde59a2a69f1>
Mon, 15 Apr 2024 02:35:16 +0000 (02:35 +0000)
git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@25 f982e544-4a7d-3444-ad1a-fde59a2a69f1

mkpasswd.pl [new file with mode: 0644]

diff --git a/mkpasswd.pl b/mkpasswd.pl
new file mode 100644 (file)
index 0000000..e284ecb
--- /dev/null
@@ -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");