From dbfa8e5cf65dc029f23a958e1cb15dafe541ac4b Mon Sep 17 00:00:00 2001
From: nishi <nishi@f982e544-4a7d-3444-ad1a-fde59a2a69f1>
Date: Mon, 15 Apr 2024 02:35:16 +0000
Subject: [PATCH] password generator

git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@25 f982e544-4a7d-3444-ad1a-fde59a2a69f1
---
 mkpasswd.pl | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 mkpasswd.pl

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");
-- 
2.43.0